3 Forward declares `boost::hana::zip`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_ZIP_HPP
11 #define BOOST_HANA_FWD_ZIP_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Zip one sequence or more.
19 //! @ingroup group-Sequence
21 //! Given `n` sequences `s1, ..., sn`, `zip` produces a sequence whose
22 //! `i`-th element is a tuple of `(s1[i], ..., sn[i])`, where `sk[i]`
23 //! denotes the `i`-th element of the `k`-th sequence. In other words,
24 //! `zip` produces a sequence of the form
27 //! make_tuple(s1[0], ..., sn[0]),
28 //! make_tuple(s1[1], ..., sn[1]),
30 //! make_tuple(s1[M], ..., sn[M])
33 //! where `M` is the length of the sequences, which are all assumed to
34 //! have the same length. Assuming the sequences to all have the same size
35 //! allows the library to perform some optimizations. To zip sequences
36 //! that may have different lengths, `zip_shortest` should be used
37 //! instead. Also note that it is an error to provide no sequence at all,
38 //! i.e. `zip` expects at least one sequence.
43 //! @include example/zip.cpp
44 #ifdef BOOST_HANA_DOXYGEN_INVOKED
45 constexpr auto zip = [](auto&& x1, ..., auto&& xn) {
46 return tag-dispatched;
49 template <typename S, typename = void>
50 struct zip_impl : zip_impl<S, when<true>> { };
53 template <typename Xs, typename ...Ys>
54 constexpr auto operator()(Xs&& xs, Ys&& ...ys) const;
57 constexpr zip_t zip{};
59 BOOST_HANA_NAMESPACE_END
61 #endif // !BOOST_HANA_FWD_ZIP_HPP