Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:05

0001 /*!
0002 @file
0003 Forward declares `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_FWD_ZIP_HPP
0011 #define BOOST_HANA_FWD_ZIP_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Zip one sequence or more.
0019     //! @ingroup group-Sequence
0020     //!
0021     //! Given `n` sequences `s1, ..., sn`, `zip` produces a sequence whose
0022     //! `i`-th element is a tuple of `(s1[i], ..., sn[i])`, where `sk[i]`
0023     //! denotes the `i`-th element of the `k`-th sequence. In other words,
0024     //! `zip` produces a sequence of the form
0025     //! @code
0026     //!     [
0027     //!         make_tuple(s1[0], ..., sn[0]),
0028     //!         make_tuple(s1[1], ..., sn[1]),
0029     //!         ...
0030     //!         make_tuple(s1[M], ..., sn[M])
0031     //!     ]
0032     //! @endcode
0033     //! where `M` is the length of the sequences, which are all assumed to
0034     //! have the same length. Assuming the sequences to all have the same size
0035     //! allows the library to perform some optimizations. To zip sequences
0036     //! that may have different lengths, `zip_shortest` should be used
0037     //! instead. Also note that it is an error to provide no sequence at all,
0038     //! i.e. `zip` expects at least one sequence.
0039     //!
0040     //!
0041     //! Example
0042     //! -------
0043     //! @include example/zip.cpp
0044 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0045     constexpr auto zip = [](auto&& x1, ..., auto&& xn) {
0046         return tag-dispatched;
0047     };
0048 #else
0049     template <typename S, typename = void>
0050     struct zip_impl : zip_impl<S, when<true>> { };
0051 
0052     struct zip_t {
0053         template <typename Xs, typename ...Ys>
0054         constexpr auto operator()(Xs&& xs, Ys&& ...ys) const;
0055     };
0056 
0057     BOOST_HANA_INLINE_VARIABLE constexpr zip_t zip{};
0058 #endif
0059 }} // end namespace boost::hana
0060 
0061 #endif // !BOOST_HANA_FWD_ZIP_HPP