.. _program_listing_file_include_beluga_views_zip.hpp: Program Listing for File zip.hpp ================================ |exhale_lsh| :ref:`Return to documentation for file ` (``include/beluga/views/zip.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2024 Ekumen, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef BELUGA_VIEWS_ZIP_HPP #define BELUGA_VIEWS_ZIP_HPP #include #include namespace beluga::views { namespace detail { struct as_common_tuple_indirect_fn { template constexpr auto operator()(const Its&... its) const // noexcept((noexcept(ranges::iter_reference_t(*its)) && ...)) { return ranges::common_tuple...>{*its...}; } template constexpr auto operator()(ranges::move_tag, const Its&... its) const noexcept((noexcept(ranges::iter_rvalue_reference_t(ranges::iter_move(its))) && ...)) { return ranges::common_tuple...>{ranges::iter_move(its)...}; } template constexpr auto operator()(ranges::copy_tag, Its...) const -> std::tuple...> { assert(false); // NOLINT(misc-static-assert) return {}; } }; struct zip_fn { template constexpr auto operator()(Ranges&&... ranges) const { return ranges::views::iter_zip_with(as_common_tuple_indirect_fn{}, std::forward(ranges)...); } }; } // namespace detail inline constexpr detail::zip_fn zip; } // namespace beluga::views #endif