vmd_modifiers_single_element.qbk 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. [section:vmd_modifiers_single Modifiers and the single-element sequence]
  8. A single element sequence is what we normally think of when
  9. working with macro data. It is a single type of macro data
  10. passed as an input parameter to some macro and processed as
  11. such.
  12. In its basic form without modifiers BOOST_VMD_ELEM serves
  13. to just return a particular element of a sequence. For
  14. a single element sequence BOOST_VMD_ELEM with element
  15. number 0, just returns the single-element sequence itself. This does not
  16. offer much functionality for our simple sequence. However with
  17. modifiers we can do things generically with our single-element
  18. sequence which correspond to working with a single type of data
  19. and extracting information about it.
  20. With the return type modifier we can get the type of the data
  21. along with the data. Of course we can also use BOOST_VMD_GET_TYPE
  22. to retrieve just the type of data.
  23. With our filter modifier we can retrieve the data only if it is a particular
  24. type, else retrieve emptiness.
  25. With the identifier modifier we can retrieve an identifier only if it
  26. matches one or more other identifiers, else retrieve emptiness.
  27. With our index modifier we can retrieve both our
  28. identifier and its numeric index if it matches one or more
  29. other identifiers, else retrieve a tuple of two empty elements
  30. if no match is found.
  31. [endsect]