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_shortest`.
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_SHORTEST_HPP
0011 #define BOOST_HANA_FWD_ZIP_SHORTEST_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_shortest` produces a sequence
0022     //! whose `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_shortest` 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 shortest sequence. Hence, the returned
0034     //! sequence stops when the shortest input sequence is exhausted. If you
0035     //! know that all the sequences you are about to zip have the same length,
0036     //! you should use `zip` instead, since it can be more optimized. Also
0037     //! note that it is an error to provide no sequence at all, i.e.
0038     //! `zip_shortest` expects at least one sequence.
0039     //!
0040     //!
0041     //! Example
0042     //! -------
0043     //! @include example/zip_shortest.cpp
0044 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0045     constexpr auto zip_shortest = [](auto&& x1, ..., auto&& xn) {
0046         return tag-dispatched;
0047     };
0048 #else
0049     template <typename S, typename = void>
0050     struct zip_shortest_impl : zip_shortest_impl<S, when<true>> { };
0051 
0052     struct zip_shortest_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_shortest_t zip_shortest{};
0058 #endif
0059 }} // end namespace boost::hana
0060 
0061 #endif // !BOOST_HANA_FWD_ZIP_SHORTEST_HPP