|
||||
File indexing completed on 2025-01-18 09:38:17
0001 /*============================================================================= 0002 Copyright (c) 2016 Paul Fultz II 0003 unpack_sequence.hpp 0004 Distributed under the Boost Software License, Version 1.0. (See accompanying 0005 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0006 ==============================================================================*/ 0007 0008 #ifndef BOOST_HOF_GUARD_UNPACK_SEQUENCE_HPP 0009 #define BOOST_HOF_GUARD_UNPACK_SEQUENCE_HPP 0010 0011 /// unpack_sequence 0012 /// =============== 0013 /// 0014 /// How to unpack a sequence can be defined by specializing `unpack_sequence`. 0015 /// By default, `std::tuple` is already specialized. To implement this, one 0016 /// needs to provide a static `apply` function which will unpack the sequence 0017 /// to the parameters of the function. 0018 /// 0019 /// Synopsis 0020 /// -------- 0021 /// 0022 /// template<class Sequence, class=void> 0023 /// struct unpack_sequence; 0024 /// 0025 /// Example 0026 /// ------- 0027 /// 0028 /// #include <boost/hof.hpp> 0029 /// #include <cassert> 0030 /// 0031 /// struct my_sequence 0032 /// { 0033 /// int x; 0034 /// int y; 0035 /// }; 0036 /// 0037 /// namespace boost { namespace hof { 0038 /// template<> 0039 /// struct unpack_sequence<my_sequence> 0040 /// { 0041 /// template<class F, class Sequence> 0042 /// constexpr static auto apply(F&& f, Sequence&& s) BOOST_HOF_RETURNS 0043 /// ( 0044 /// f(s.x, s.y) 0045 /// ); 0046 /// }; 0047 /// }} // namespace boost::hof 0048 /// 0049 /// int main() { 0050 /// } 0051 /// 0052 /// See Also 0053 /// -------- 0054 /// 0055 /// * [unpack](unpack) 0056 /// * [is_unpackable](is_unpackable) 0057 /// 0058 0059 #include <boost/hof/config.hpp> 0060 0061 namespace boost { namespace hof { 0062 0063 template<class Sequence, class=void> 0064 struct unpack_sequence 0065 { 0066 typedef void not_unpackable; 0067 }; 0068 0069 }} // namespace boost::hof 0070 0071 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |