Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:06

0001 /*!
0002 @file
0003 Defines `boost::hana::zip`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_ZIP_HPP
0011 #define BOOST_HANA_ZIP_HPP
0012 
0013 #include <boost/hana/fwd/zip.hpp>
0014 
0015 #include <boost/hana/concept/sequence.hpp>
0016 #include <boost/hana/config.hpp>
0017 #include <boost/hana/core/dispatch.hpp>
0018 #include <boost/hana/detail/fast_and.hpp>
0019 #include <boost/hana/tuple.hpp>
0020 #include <boost/hana/zip_with.hpp>
0021 
0022 
0023 namespace boost { namespace hana {
0024     //! @cond
0025     template <typename Xs, typename ...Ys>
0026     constexpr auto zip_t::operator()(Xs&& xs, Ys&& ...ys) const {
0027     #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
0028         static_assert(detail::fast_and<
0029             hana::Sequence<Xs>::value, hana::Sequence<Ys>::value...
0030         >::value,
0031         "hana::zip(xs, ys...) requires 'xs' and 'ys...' to be Sequences");
0032     #endif
0033 
0034         return zip_impl<typename hana::tag_of<Xs>::type>::apply(
0035             static_cast<Xs&&>(xs),
0036             static_cast<Ys&&>(ys)...
0037         );
0038     }
0039     //! @endcond
0040 
0041     template <typename S, bool condition>
0042     struct zip_impl<S, when<condition>> : default_ {
0043         template <typename ...Xs>
0044         static constexpr decltype(auto) apply(Xs&& ...xs) {
0045             return hana::zip_with(hana::make_tuple, static_cast<Xs&&>(xs)...);
0046         }
0047     };
0048 }} // end namespace boost::hana
0049 
0050 #endif // !BOOST_HANA_ZIP_HPP