]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | (C) Copyright Edward Diener 2011-2015 | |
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt). | |
6 | ] | |
7 | ||
8 | [section:vmd_modifiers_single Modifiers and the single-element sequence] | |
9 | ||
10 | A single element sequence is what we normally think of when | |
11 | working with macro data. It is a single type of macro data | |
12 | passed as an input parameter to some macro and processed as | |
13 | such. | |
14 | ||
15 | In its basic form without modifiers BOOST_VMD_ELEM serves | |
16 | to just return a particular element of a sequence. For | |
17 | a single element sequence BOOST_VMD_ELEM with element | |
18 | number 0, just returns the single-element sequence itself. This does not | |
19 | offer much functionality for our simple sequence. However with | |
20 | modifiers we can do things generically with our single-element | |
21 | sequence which correspond to working with a single type of data | |
22 | and extracting information about it. | |
23 | ||
24 | With the return type modifier we can get the type of the data | |
25 | along with the data. Of course we can also use BOOST_VMD_GET_TYPE | |
26 | to retrieve just the type of data. | |
27 | ||
28 | With our filter modifier we can retrieve the data only if it is a particular | |
29 | type, else retrieve emptiness. | |
30 | ||
31 | With the identifier modifier we can retrieve an identifier only if it | |
32 | matches one or more other identifiers, else retrieve emptiness. | |
33 | ||
34 | With our index modifier we can retrieve both our | |
35 | identifier and its numeric index if it matches one or more | |
36 | other identifiers, else retrieve a tuple of two empty elements | |
37 | if no match is found. | |
38 | ||
39 | [endsect] |