3 Forward declares `boost::hana::zip_with`.
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_WITH_HPP
11 #define BOOST_HANA_FWD_ZIP_WITH_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 with a given function.
19 //! @ingroup group-Sequence
21 //! Given a `n`-ary function `f` and `n` sequences `s1, ..., sn`,
22 //! `zip_with` produces a sequence whose `i`-th element is
23 //! `f(s1[i], ..., sn[i])`, where `sk[i]` denotes the `i`-th element of
24 //! the `k`-th sequence. In other words, `zip_with` produces a sequence
28 //! f(s1[0], ..., sn[0]),
29 //! f(s1[1], ..., sn[1]),
31 //! f(s1[M], ..., sn[M])
34 //! where `M` is the length of the sequences, which are all assumed to
35 //! have the same length. Assuming the sequences to all have the same size
36 //! allows the library to perform some optimizations. To zip sequences
37 //! that may have different lengths, `zip_shortest_with` should be used
38 //! instead. Also note that it is an error to provide no sequence at all,
39 //! i.e. `zip_with` expects at least one sequence.
44 //! @include example/zip_with.cpp
45 #ifdef BOOST_HANA_DOXYGEN_INVOKED
46 constexpr auto zip_with = [](auto&& f, auto&& x1, ..., auto&& xn) {
47 return tag-dispatched;
50 template <typename S, typename = void>
51 struct zip_with_impl : zip_with_impl<S, when<true>> { };
54 template <typename F, typename Xs, typename ...Ys>
55 constexpr auto operator()(F&& f, Xs&& xs, Ys&& ...ys) const;
58 constexpr zip_with_t zip_with{};
60 BOOST_HANA_NAMESPACE_END
62 #endif // !BOOST_HANA_FWD_ZIP_WITH_HPP