]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | // (C) Copyright Edward Diener 2011-2015 | |
3 | // Use, modification and distribution are subject to the Boost Software License, | |
4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt). | |
6 | ||
7 | #if !defined(BOOST_VMD_TO_TUPLE_HPP) | |
8 | #define BOOST_VMD_TO_TUPLE_HPP | |
9 | ||
10 | #include <boost/vmd/detail/setup.hpp> | |
11 | ||
12 | #if BOOST_PP_VARIADICS | |
13 | ||
14 | #include <boost/vmd/detail/sequence_to_tuple.hpp> | |
15 | ||
16 | /* | |
17 | ||
18 | The succeeding comments in this file are in doxygen format. | |
19 | ||
20 | */ | |
21 | ||
22 | /** \file | |
23 | */ | |
24 | ||
25 | /** \def BOOST_VMD_TO_TUPLE(...) | |
26 | ||
27 | \brief Converts a sequence to a Boost PP tuple whose elements are the elements of the sequence. | |
28 | ||
29 | ... = Variadic parameters. | |
30 | ||
31 | The first variadic parameter is required and is the sequence to convert. | |
32 | ||
33 | Further optional variadic parameters can be return type parameters. Return type | |
34 | parameters allow each element in the sequence to be converted to a two-element | |
35 | tuple where the first tuple element is the type and the second tuple element | |
36 | is the element data. | |
37 | ||
38 | The BOOST_VMD_RETURN_NO_TYPE, the default, does not return the type as part of each | |
39 | converted element but just the data. All of the rest return the type and data as the | |
40 | two-element tuple. If BOOST_VMD_RETURN_TYPE is specified the specific type of the element | |
41 | is returned in the tuple. If BOOST_VMD_RETURN_TYPE_ARRAY is specified an array type is | |
42 | returned if the element is an array, else a tuple type is returned if the element is a tuple, | |
43 | else the actual type is returned for non-tuple data. If BOOST_VMD_RETURN_TYPE_LIST is specified | |
44 | a list type is returned if the element is a list, else a tuple type is returned if the element | |
45 | is a tuple, else the actual type is returned for non-tuple data. If BOOST_VMD_RETURN_TYPE_TUPLE | |
46 | is specified a tuple type is returned for all tuple-like data, else the actual type is returned | |
47 | for non-tuple data. If more than one return type optional parameter is specified the last one | |
48 | specified determines the return type. | |
49 | ||
50 | returns = A Boost PP tuple. If the sequence is empty the return is emptiness | |
51 | since an empty tuple does not exist. If an optional return type other | |
52 | than BOOST_VMD_RETURN_NO_TYPE is specified the type and the data of | |
53 | each element is returned as the tuple element. Otherwise just the data | |
54 | is returned as the tuple element, which is the default. | |
55 | ||
56 | */ | |
57 | ||
58 | #define BOOST_VMD_TO_TUPLE(...) \ | |
59 | BOOST_VMD_DETAIL_SEQUENCE_TO_TUPLE(__VA_ARGS__) \ | |
60 | /**/ | |
61 | ||
62 | /** \def BOOST_VMD_TO_TUPLE_D(d,...) | |
63 | ||
64 | \brief Converts a sequence to a Boost PP tuple whose elements are the elements of the sequence. Re-entrant version. | |
65 | ||
66 | d = The next available BOOST_PP_WHILE iteration. | |
67 | ... = Variadic parameters. | |
68 | ||
69 | The first variadic parameter is required and is the sequence to convert. | |
70 | ||
71 | Further optional variadic parameters can be return type parameters. Return type | |
72 | parameters allow each element in the sequence to be converted to a two-element | |
73 | tuple where the first tuple element is the type and the second tuple element | |
74 | is the element data. | |
75 | ||
76 | The BOOST_VMD_RETURN_NO_TYPE, the default, does not return the type as part of each | |
77 | converted element but just the data. All of the rest return the type and data as the | |
78 | two-element tuple. If BOOST_VMD_RETURN_TYPE is specified the specific type of the element | |
79 | is returned in the tuple. If BOOST_VMD_RETURN_TYPE_ARRAY is specified an array type is | |
80 | returned if the element is an array, else a tuple type is returned if the element is a tuple, | |
81 | else the actual type is returned for non-tuple data. If BOOST_VMD_RETURN_TYPE_LIST is specified | |
82 | a list type is returned if the element is a list, else a tuple type is returned if the element | |
83 | is a tuple, else the actual type is returned for non-tuple data. If BOOST_VMD_RETURN_TYPE_TUPLE | |
84 | is specified a tuple type is returned for all tuple-like data, else the actual type is returned | |
85 | for non-tuple data. If more than one return type optional parameter is specified the last one | |
86 | specified determines the return type. | |
87 | ||
88 | returns = A Boost PP tuple. If the sequence is empty the return is emptiness | |
89 | since an empty tuple does not exist. If an optional return type other | |
90 | than BOOST_VMD_RETURN_NO_TYPE is specified the type and the data of | |
91 | each element is returned as the tuple element. Otherwise just the data | |
92 | is returned as the tuple element, which is the default. | |
93 | ||
94 | */ | |
95 | ||
96 | #define BOOST_VMD_TO_TUPLE_D(d,...) \ | |
97 | BOOST_VMD_DETAIL_SEQUENCE_TO_TUPLE_D(d,__VA_ARGS__) \ | |
98 | /**/ | |
99 | ||
100 | #endif /* BOOST_PP_VARIADICS */ | |
101 | #endif /* BOOST_VMD_TO_TUPLE_HPP */ |