vmd/doc/vmd_modifiers_single_element.qbk
2015-08-25 17:48:35 -04:00

39 lines
1.5 KiB
Plaintext

[/
(C) Copyright Edward Diener 2011-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]
[section:vmd_modifiers_single Modifiers and the single-element sequence]
A single element sequence is what we normally think of when
working with macro data. It is a single type of macro data
passed as an input parameter to some macro and processed as
such.
In its basic form without modifiers BOOST_VMD_ELEM serves
to just return a particular element of a sequence. For
a single element sequence BOOST_VMD_ELEM with element
number 0, just returns the single-element sequence itself. This does not
offer much functionality for our simple sequence. However with
modifiers we can do things generically with our single-element
sequence which correspond to working with a single type of data
and extracting information about it.
With the return type modifier we can get the type of the data
along with the data. Of course we can also use BOOST_VMD_GET_TYPE
to retrieve just the type of data.
With our filter modifier we can retrieve the data only if it is a particular
type, else retrieve emptiness.
With the identifier modifier we can retrieve an identifier only if it
matches one or more other identifiers, else retrieve emptiness.
With our index modifier we can retrieve both our
identifier and its numeric index if it matches one or more
other identifiers, else retrieve a tuple of two empty elements
if no match is found.
[endsect]