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_with`.
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_WITH_HPP
0011 #define BOOST_HANA_FWD_ZIP_WITH_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 with a given function.
0019     //! @ingroup group-Sequence
0020     //!
0021     //! Given a `n`-ary function `f` and `n` sequences `s1, ..., sn`,
0022     //! `zip_with` produces a sequence whose `i`-th element is
0023     //! `f(s1[i], ..., sn[i])`, where `sk[i]` denotes the `i`-th element of
0024     //! the `k`-th sequence. In other words, `zip_with` produces a sequence
0025     //! of the form
0026     //! @code
0027     //!     [
0028     //!         f(s1[0], ..., sn[0]),
0029     //!         f(s1[1], ..., sn[1]),
0030     //!         ...
0031     //!         f(s1[M], ..., sn[M])
0032     //!     ]
0033     //! @endcode
0034     //! where `M` is the length of the sequences, which are all assumed to
0035     //! have the same length. Assuming the sequences to all have the same size
0036     //! allows the library to perform some optimizations. To zip sequences
0037     //! that may have different lengths, `zip_shortest_with` should be used
0038     //! instead. Also note that it is an error to provide no sequence at all,
0039     //! i.e. `zip_with` expects at least one sequence.
0040     //!
0041     //!
0042     //! Example
0043     //! -------
0044     //! @include example/zip_with.cpp
0045 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0046     constexpr auto zip_with = [](auto&& f, auto&& x1, ..., auto&& xn) {
0047         return tag-dispatched;
0048     };
0049 #else
0050     template <typename S, typename = void>
0051     struct zip_with_impl : zip_with_impl<S, when<true>> { };
0052 
0053     struct zip_with_t {
0054         template <typename F, typename Xs, typename ...Ys>
0055         constexpr auto operator()(F&& f, Xs&& xs, Ys&& ...ys) const;
0056     };
0057 
0058     BOOST_HANA_INLINE_VARIABLE constexpr zip_with_t zip_with{};
0059 #endif
0060 }} // end namespace boost::hana
0061 
0062 #endif // !BOOST_HANA_FWD_ZIP_WITH_HPP