3 Forward declares `boost::hana::zip_shortest`.
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_SHORTEST_HPP
11 #define BOOST_HANA_FWD_ZIP_SHORTEST_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_shortest` produces a sequence
22 //! whose `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_shortest` 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 shortest sequence. Hence, the returned
34 //! sequence stops when the shortest input sequence is exhausted. If you
35 //! know that all the sequences you are about to zip have the same length,
36 //! you should use `zip` instead, since it can be more optimized. Also
37 //! note that it is an error to provide no sequence at all, i.e.
38 //! `zip_shortest` expects at least one sequence.
43 //! @include example/zip_shortest.cpp
44 #ifdef BOOST_HANA_DOXYGEN_INVOKED
45 constexpr auto zip_shortest = [](auto&& x1, ..., auto&& xn) {
46 return tag-dispatched;
49 template <typename S, typename = void>
50 struct zip_shortest_impl : zip_shortest_impl<S, when<true>> { };
52 struct zip_shortest_t {
53 template <typename Xs, typename ...Ys>
54 constexpr auto operator()(Xs&& xs, Ys&& ...ys) const;
57 constexpr zip_shortest_t zip_shortest{};
59 BOOST_HANA_NAMESPACE_END
61 #endif // !BOOST_HANA_FWD_ZIP_SHORTEST_HPP