|
|
|||
File indexing completed on 2025-12-15 09:53:05
0001 /*! 0002 @file 0003 Forward declares `boost::hana::zip_shortest_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_SHORTEST_WITH_HPP 0011 #define BOOST_HANA_FWD_ZIP_SHORTEST_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_shortest_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_shortest_with` produces a 0025 //! sequence 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 shortest sequence. Hence, the returned 0035 //! sequence stops when the shortest input sequence is exhausted. If you 0036 //! know that all the sequences you are about to zip have the same length, 0037 //! you should use `zip_with` instead, since it can be more optimized. 0038 //! Also note that it is an error to provide no sequence at all, i.e. 0039 //! `zip_shortest_with` expects at least one sequence. 0040 //! 0041 //! 0042 //! Example 0043 //! ------- 0044 //! @include example/zip_shortest_with.cpp 0045 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0046 constexpr auto zip_shortest_with = [](auto&& f, auto&& x1, ..., auto&& xn) { 0047 return tag-dispatched; 0048 }; 0049 #else 0050 template <typename S, typename = void> 0051 struct zip_shortest_with_impl : zip_shortest_with_impl<S, when<true>> { }; 0052 0053 struct zip_shortest_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_shortest_with_t zip_shortest_with{}; 0059 #endif 0060 }} // end namespace boost::hana 0061 0062 #endif // !BOOST_HANA_FWD_ZIP_SHORTEST_WITH_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|