3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Chapter 1. The Variadic Macro Data Library 1.9</title>
5 <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="Chapter 1. The Variadic Macro Data Library 1.9">
8 <link rel="next" href="variadic_macro_data/vmd_naming.html" title="Naming conventions">
10 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
11 <table cellpadding="2" width="100%"><tr>
12 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
13 <td align="center"><a href="../../../../index.html">Home</a></td>
14 <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
15 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
16 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
17 <td align="center"><a href="../../../../more/index.htm">More</a></td>
20 <div class="spirit-nav"><a accesskey="n" href="variadic_macro_data/vmd_naming.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
22 <div class="titlepage"><div>
23 <div><h2 class="title">
24 <a name="variadic_macro_data"></a>Chapter 1. The Variadic Macro Data Library 1.9</h2></div>
25 <div><div class="author"><h3 class="author">
26 <span class="firstname">Edward</span> <span class="surname">Diener</span>
28 <div><p class="copyright">Copyright © 2010-2017 Tropic Software
32 <p><b>Table of Contents</b></p>
34 <dt><span class="section"><a href="index.html#variadic_macro_data.vmd_intro">Introduction</a></span></dt>
35 <dt><span class="section"><a href="variadic_macro_data/vmd_naming.html">Naming conventions</a></span></dt>
36 <dt><span class="section"><a href="variadic_macro_data/vmd_whyhow.html">Why and how to use</a></span></dt>
37 <dt><span class="section"><a href="variadic_macro_data/vmd_vmacros.html">Using variadic macros</a></span></dt>
38 <dt><span class="section"><a href="variadic_macro_data/vmd_vc.html">Visual C++ define</a></span></dt>
39 <dt><span class="section"><a href="variadic_macro_data/vmd_detail.html">Functional groups</a></span></dt>
40 <dt><span class="section"><a href="variadic_macro_data/vmd_data_types.html">Data types</a></span></dt>
41 <dt><span class="section"><a href="variadic_macro_data/vmd_specific.html">Specific macros for working
42 with data types</a></span></dt>
44 <dt><span class="section"><a href="variadic_macro_data/vmd_specific.html#variadic_macro_data.vmd_specific.vmd_test_empty">Emptiness</a></span></dt>
45 <dt><span class="section"><a href="variadic_macro_data/vmd_specific/vmd_constraints.html">Macro
46 constraints</a></span></dt>
47 <dt><span class="section"><a href="variadic_macro_data/vmd_specific/vmd_identifier.html">Identifiers</a></span></dt>
48 <dt><span class="section"><a href="variadic_macro_data/vmd_specific/vmd_number.html">Numbers</a></span></dt>
49 <dt><span class="section"><a href="variadic_macro_data/vmd_specific/vmd_type.html">Types</a></span></dt>
50 <dt><span class="section"><a href="variadic_macro_data/vmd_specific/vmd_pp_data_types.html">VMD
51 and Boost PP data types</a></span></dt>
52 <dt><span class="section"><a href="variadic_macro_data/vmd_specific/vmd_identifying.html">Identifying
53 data types</a></span></dt>
55 <dt><span class="section"><a href="variadic_macro_data/vmd_generic.html">Generic macros for working
56 with data types</a></span></dt>
58 <dt><span class="section"><a href="variadic_macro_data/vmd_generic.html#variadic_macro_data.vmd_generic.vmd_sequence">Parsing
59 sequences</a></span></dt>
61 <dt><span class="section"><a href="variadic_macro_data/vmd_generic.html#variadic_macro_data.vmd_generic.vmd_sequence.vmd_sequence_convert">Converting
62 sequences</a></span></dt>
63 <dt><span class="section"><a href="variadic_macro_data/vmd_generic.html#variadic_macro_data.vmd_generic.vmd_sequence.vmd_sequence_access">Accessing
64 a sequence element</a></span></dt>
66 <dt><span class="section"><a href="variadic_macro_data/vmd_generic/vmd_convert_sequence.html">Getting
67 the type of data</a></span></dt>
68 <dt><span class="section"><a href="variadic_macro_data/vmd_generic/vmd_assert.html">Testing for
69 equality and inequality</a></span></dt>
71 <dt><span class="section"><a href="variadic_macro_data/vmd_modifiers.html">Macros with modifiers</a></span></dt>
73 <dt><span class="section"><a href="variadic_macro_data/vmd_modifiers.html#variadic_macro_data.vmd_modifiers.vmd_modifiers_return_type">Return
74 type modifiers</a></span></dt>
75 <dt><span class="section"><a href="variadic_macro_data/vmd_modifiers/vmd_modifiers_filter.html">Filtering
76 modifiers</a></span></dt>
77 <dt><span class="section"><a href="variadic_macro_data/vmd_modifiers/vmd_modifiers_identifier.html">Identifier
78 modifiers</a></span></dt>
79 <dt><span class="section"><a href="variadic_macro_data/vmd_modifiers/vmd_modifiers_splitting.html">Splitting
80 modifiers</a></span></dt>
81 <dt><span class="section"><a href="variadic_macro_data/vmd_modifiers/vmd_modifiers_index.html">Index
82 modifiers</a></span></dt>
83 <dt><span class="section"><a href="variadic_macro_data/vmd_modifiers/vmd_modifiers_single.html">Modifiers
84 and the single-element sequence</a></span></dt>
86 <dt><span class="section"><a href="variadic_macro_data/vmd_identifier_subtype.html">Identifier
87 subtypes</a></span></dt>
88 <dt><span class="section"><a href="variadic_macro_data/vmd_useful.html">Useful variadic macros
89 not in Boost PP</a></span></dt>
91 <dt><span class="section"><a href="variadic_macro_data/vmd_useful.html#variadic_macro_data.vmd_useful.vmd_assert">Asserting
92 and data types</a></span></dt>
93 <dt><span class="section"><a href="variadic_macro_data/vmd_useful/vmd_identity.html">Generating
94 emptiness and identity</a></span></dt>
95 <dt><span class="section"><a href="variadic_macro_data/vmd_useful/vmd_empty_ppdata.html">Functionality
96 for "empty" seqs and tuples</a></span></dt>
98 <dt><span class="section"><a href="variadic_macro_data/vmd_internal_macros.html">Controlling internal
100 <dt><span class="section"><a href="variadic_macro_data/vmd_reentrant.html">Boost PP re-entrant
101 versions</a></span></dt>
102 <dt><span class="section"><a href="variadic_macro_data/vmd_dynamic_typing.html">Input as dynamic
103 types</a></span></dt>
104 <dt><span class="section"><a href="variadic_macro_data/vmd_vc_isms.html">Visual C++ gotchas in
106 <dt><span class="section"><a href="variadic_macro_data/vmd_conv.html">Version 1.7 to 1.8 conversion</a></span></dt>
107 <dt><span class="section"><a href="variadic_macro_data/vmd_examples.html">Examples using VMD functionality</a></span></dt>
108 <dt><span class="section"><a href="variadic_macro_data_reference.html">Variadic Macro Data Reference</a></span></dt>
110 <dt><span class="section"><a href="variadic_macro_data_reference.html#header.boost.vmd.array.to_seq_hpp">Header <boost/vmd/array/to_seq.hpp></a></span></dt>
112 <dt><span class="section"><a href="header/boost/vmd/list/to_seq_hpp.html">Header <boost/vmd/list/to_seq.hpp></a></span></dt>
114 <dt><span class="section"><a href="header/boost/vmd/to_seq_hpp.html">Header <boost/vmd/to_seq.hpp></a></span></dt>
116 <dt><span class="section"><a href="header/boost/vmd/tuple/to_seq_hpp.html">Header <boost/vmd/tuple/to_seq.hpp></a></span></dt>
118 <dt><span class="section"><a href="header/boost/vmd/array/to_tuple_hpp.html">Header <boost/vmd/array/to_tuple.hpp></a></span></dt>
120 <dt><span class="section"><a href="header/boost/vmd/list/to_tuple_hpp.html">Header <boost/vmd/list/to_tuple.hpp></a></span></dt>
122 <dt><span class="section"><a href="header/boost/vmd/seq/to_tuple_hpp.html">Header <boost/vmd/seq/to_tuple.hpp></a></span></dt>
124 <dt><span class="section"><a href="header/boost/vmd/to_tuple_hpp.html">Header <boost/vmd/to_tuple.hpp></a></span></dt>
126 <dt><span class="section"><a href="header/boost/vmd/assert_hpp.html">Header <boost/vmd/assert.hpp></a></span></dt>
128 <dt><span class="section"><a href="header/boost/vmd/assert_is_array_hpp.html">Header <boost/vmd/assert_is_array.hpp></a></span></dt>
130 <dt><span class="section"><a href="header/boost/vmd/assert_is_empty_hpp.html">Header <boost/vmd/assert_is_empty.hpp></a></span></dt>
132 <dt><span class="section"><a href="header/boost/vmd/assert_is_identifier_hpp.html">Header <boost/vmd/assert_is_identifier.hpp></a></span></dt>
134 <dt><span class="section"><a href="header/boost/vmd/assert_is_list_hpp.html">Header <boost/vmd/assert_is_list.hpp></a></span></dt>
136 <dt><span class="section"><a href="header/boost/vmd/assert_is_number_hpp.html">Header <boost/vmd/assert_is_number.hpp></a></span></dt>
138 <dt><span class="section"><a href="header/boost/vmd/assert_is_seq_hpp.html">Header <boost/vmd/assert_is_seq.hpp></a></span></dt>
140 <dt><span class="section"><a href="header/boost/vmd/assert_is_tuple_hpp.html">Header <boost/vmd/assert_is_tuple.hpp></a></span></dt>
142 <dt><span class="section"><a href="header/boost/vmd/assert_is_type_hpp.html">Header <boost/vmd/assert_is_type.hpp></a></span></dt>
144 <dt><span class="section"><a href="header/boost/vmd/elem_hpp.html">Header <boost/vmd/elem.hpp></a></span></dt>
146 <dt><span class="section"><a href="header/boost/vmd/empty_hpp.html">Header <boost/vmd/empty.hpp></a></span></dt>
148 <dt><span class="section"><a href="header/boost/vmd/enum_hpp.html">Header <boost/vmd/enum.hpp></a></span></dt>
150 <dt><span class="section"><a href="header/boost/vmd/equal_hpp.html">Header <boost/vmd/equal.hpp></a></span></dt>
152 <dt><span class="section"><a href="header/boost/vmd/get_type_hpp.html">Header <boost/vmd/get_type.hpp></a></span></dt>
154 <dt><span class="section"><a href="header/boost/vmd/identity_hpp.html">Header <boost/vmd/identity.hpp></a></span></dt>
156 <dt><span class="section"><a href="header/boost/vmd/is_array_hpp.html">Header <boost/vmd/is_array.hpp></a></span></dt>
158 <dt><span class="section"><a href="header/boost/vmd/is_empty_hpp.html">Header <boost/vmd/is_empty.hpp></a></span></dt>
160 <dt><span class="section"><a href="header/boost/vmd/is_empty_array_hpp.html">Header <boost/vmd/is_empty_array.hpp></a></span></dt>
162 <dt><span class="section"><a href="header/boost/vmd/is_empty_list_hpp.html">Header <boost/vmd/is_empty_list.hpp></a></span></dt>
164 <dt><span class="section"><a href="header/boost/vmd/is_identifier_hpp.html">Header <boost/vmd/is_identifier.hpp></a></span></dt>
166 <dt><span class="section"><a href="header/boost/vmd/is_list_hpp.html">Header <boost/vmd/is_list.hpp></a></span></dt>
168 <dt><span class="section"><a href="header/boost/vmd/is_multi_hpp.html">Header <boost/vmd/is_multi.hpp></a></span></dt>
170 <dt><span class="section"><a href="header/boost/vmd/is_number_hpp.html">Header <boost/vmd/is_number.hpp></a></span></dt>
172 <dt><span class="section"><a href="header/boost/vmd/is_parens_empty_hpp.html">Header <boost/vmd/is_parens_empty.hpp></a></span></dt>
174 <dt><span class="section"><a href="header/boost/vmd/is_seq_hpp.html">Header <boost/vmd/is_seq.hpp></a></span></dt>
176 <dt><span class="section"><a href="header/boost/vmd/is_tuple_hpp.html">Header <boost/vmd/is_tuple.hpp></a></span></dt>
178 <dt><span class="section"><a href="header/boost/vmd/is_type_hpp.html">Header <boost/vmd/is_type.hpp></a></span></dt>
180 <dt><span class="section"><a href="header/boost/vmd/is_unary_hpp.html">Header <boost/vmd/is_unary.hpp></a></span></dt>
182 <dt><span class="section"><a href="header/boost/vmd/not_equal_hpp.html">Header <boost/vmd/not_equal.hpp></a></span></dt>
184 <dt><span class="section"><a href="header/boost/vmd/seq/is_vmd_seq_hpp.html">Header <boost/vmd/seq/is_vmd_seq.hpp></a></span></dt>
186 <dt><span class="section"><a href="header/boost/vmd/seq/pop_back_hpp.html">Header <boost/vmd/seq/pop_back.hpp></a></span></dt>
188 <dt><span class="section"><a href="header/boost/vmd/tuple/pop_back_hpp.html">Header <boost/vmd/tuple/pop_back.hpp></a></span></dt>
190 <dt><span class="section"><a href="header/boost/vmd/seq/pop_front_hpp.html">Header <boost/vmd/seq/pop_front.hpp></a></span></dt>
192 <dt><span class="section"><a href="header/boost/vmd/tuple/pop_front_hpp.html">Header <boost/vmd/tuple/pop_front.hpp></a></span></dt>
194 <dt><span class="section"><a href="header/boost/vmd/seq/push_back_hpp.html">Header <boost/vmd/seq/push_back.hpp></a></span></dt>
196 <dt><span class="section"><a href="header/boost/vmd/tuple/push_back_hpp.html">Header <boost/vmd/tuple/push_back.hpp></a></span></dt>
198 <dt><span class="section"><a href="header/boost/vmd/seq/push_front_hpp.html">Header <boost/vmd/seq/push_front.hpp></a></span></dt>
200 <dt><span class="section"><a href="header/boost/vmd/tuple/push_front_hpp.html">Header <boost/vmd/tuple/push_front.hpp></a></span></dt>
202 <dt><span class="section"><a href="header/boost/vmd/seq/remove_hpp.html">Header <boost/vmd/seq/remove.hpp></a></span></dt>
204 <dt><span class="section"><a href="header/boost/vmd/tuple/remove_hpp.html">Header <boost/vmd/tuple/remove.hpp></a></span></dt>
206 <dt><span class="section"><a href="header/boost/vmd/seq/size_hpp.html">Header <boost/vmd/seq/size.hpp></a></span></dt>
208 <dt><span class="section"><a href="header/boost/vmd/size_hpp.html">Header <boost/vmd/size.hpp></a></span></dt>
210 <dt><span class="section"><a href="header/boost/vmd/tuple/size_hpp.html">Header <boost/vmd/tuple/size.hpp></a></span></dt>
212 <dt><span class="section"><a href="header/boost/vmd/seq/to_array_hpp.html">Header <boost/vmd/seq/to_array.hpp></a></span></dt>
214 <dt><span class="section"><a href="header/boost/vmd/to_array_hpp.html">Header <boost/vmd/to_array.hpp></a></span></dt>
216 <dt><span class="section"><a href="header/boost/vmd/tuple/to_array_hpp.html">Header <boost/vmd/tuple/to_array.hpp></a></span></dt>
218 <dt><span class="section"><a href="header/boost/vmd/seq/to_list_hpp.html">Header <boost/vmd/seq/to_list.hpp></a></span></dt>
220 <dt><span class="section"><a href="header/boost/vmd/to_list_hpp.html">Header <boost/vmd/to_list.hpp></a></span></dt>
222 <dt><span class="section"><a href="header/boost/vmd/tuple/to_list_hpp.html">Header <boost/vmd/tuple/to_list.hpp></a></span></dt>
224 <dt><span class="section"><a href="header/boost/vmd/tuple/is_vmd_tuple_hpp.html">Header <boost/vmd/tuple/is_vmd_tuple.hpp></a></span></dt>
227 <dt><span class="section"><a href="variadic_macro_data/vmd_design.html">Design</a></span></dt>
228 <dt><span class="section"><a href="variadic_macro_data/vmd_compilers.html">Compilers</a></span></dt>
229 <dt><span class="section"><a href="variadic_macro_data/vmd_history.html">History</a></span></dt>
230 <dt><span class="section"><a href="variadic_macro_data/vmd_ack.html">Acknowledgements</a></span></dt>
231 <dt><span class="section"><a href="index/s24.html">Index</a></span></dt>
234 <div class="section">
235 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
236 <a name="variadic_macro_data.vmd_intro"></a><a class="link" href="index.html#variadic_macro_data.vmd_intro" title="Introduction">Introduction</a>
237 </h2></div></div></div>
239 Welcome to the Variadic Macro Data library.
242 The Variadic Macro Data library, referred to hereafter as VMD for short, is
243 a library of variadic macros which provide enhancements to the functionality
244 in the Boost preprocessor library ( Boost PP ), especially as it relates to
245 preprocessor data types.
248 The preprocessor data types with which VMD has specific functionality are emptiness,
249 identifiers, numbers ( a subset of identifiers ), types ( a subset of identifiers
250 ), Boost PP arrays, Boost PP lists, Boost PP seqs, Boost PP tuples, and sequences.
251 The first four are basic preprocessor data types while the latter five are
252 composite preprocessor data types. A sequence is zero or more of the other
253 preprocessor data types following each other.
256 <a name="variadic_macro_data.vmd_intro.h0"></a>
257 <span class="phrase"><a name="variadic_macro_data.vmd_intro.data_type_examples"></a></span><a class="link" href="index.html#variadic_macro_data.vmd_intro.data_type_examples">Data
261 <a name="variadic_macro_data.vmd_intro.dwe"></a><p class="title"><b>Table 1.1. Data types with examples</b></p>
262 <div class="table-contents"><table class="table" summary="Data types with examples">
312 BOOST_VMD_TYPE_NUMBER
324 (4,(an_identifier,156,BOOST_VMD_TYPE_IDENTIFIER))
336 (78,(some_identifier,(BOOST_VMD_TYPE_TYPE,BOOST_PP_NIL)))
348 (identifier)(89)(245)
360 (any_id,175,BOOST_VMD_TYPE_LIST,happy,21)
372 tree 59 (56,BOOST_VMD_TYPE_SEQ) (128)(fire)(clown) (47,(BOOST_VMD_TYPE_TUPLE,BOOST_PP_NIL))
379 <br class="table-break"><p>
380 Emptiness is the lack of any preprocessing tokens. A macro which expands to
383 <pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">RETURN_NOTHING</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span>
386 is said to return emptiness. Conversely a macro could accept nothing when invoked,
389 <pre class="programlisting"><span class="identifier">RETURN_NOTHING</span><span class="special">()</span>
392 Finally emptiness can be part of any composite data type as in:
394 <pre class="programlisting"><span class="special">(</span><span class="number">45</span><span class="special">,,</span><span class="identifier">some_name</span><span class="special">)</span>
397 where the second tuple element is empty.
400 <a name="variadic_macro_data.vmd_intro.h1"></a>
401 <span class="phrase"><a name="variadic_macro_data.vmd_intro.what_is_the_advantage"></a></span><a class="link" href="index.html#variadic_macro_data.vmd_intro.what_is_the_advantage">What
402 is the advantage ?</a>
405 VMD can identify any of the preprocessor data types previously mentioned, and
406 can parse sequences into their individual preprocessor data types. You may
407 well ask why that is important.
410 In Boost PP macro programming a great deal of the control logic of designing
411 a macro is based on the support Boost PP has for numbers and testing for the
412 value of a number, in particular 0 and 1 to represent boolean choices. Essentially
413 Boost PP often uses the value of a number to control the logic in a macro's
417 VMD does not attempt, in any way, to duplicate Boost PP's support for testing
418 the value of numbers or of the boolean 0 or 1 values, but just reuses that
419 functionality. What VMD offers, which goes beyond Boost PP, is a system for
420 deciphering the preprocessor data types, as well as comparing any of the preprocessor
421 data types for equality to any given value. This allows macro logic to be designed
422 in a more flexible way, relying on the type of data and/or the value of the
423 data. If this intrigues you, continue reading to understand how you can use
424 VMD to do macro programming.
427 <a name="variadic_macro_data.vmd_intro.h2"></a>
428 <span class="phrase"><a name="variadic_macro_data.vmd_intro.functionality_areas"></a></span><a class="link" href="index.html#variadic_macro_data.vmd_intro.functionality_areas">Functionality
432 The functionality of the library may be summed up as:
434 <div class="orderedlist"><ol class="orderedlist" type="1">
435 <li class="listitem">
436 Provide a better way of testing for and using empty parameters and empty
439 <li class="listitem">
440 Provide ways for testing/parsing for identifiers, numbers, types, tuples,
441 arrays, lists, and seqs.
443 <li class="listitem">
444 Provide ways for testing/parsing sequences of identifiers, numbers, types,
445 tuples, arrays, lists. and seqs.
447 <li class="listitem">
448 Provide some useful variadic macros not in Boost PP.
452 The library is a header only library and all macros in the library are included
453 by a single header, whose name is 'vmd.hpp'. Individual headers may be used
454 for different functionality in the library and will be denoted when that functionality
458 All the macros in the library begin with the sequence 'BOOST_VMD_' to distinguish
459 them from other macros the end-user might use. Therefore the end-user should
460 not use any C++ identifiers, whether in macros or otherwise, which being with
461 the sequence 'BOOST_VMD_'.
464 Use of the library is only dependent on Boost PP. The library also uses Boost
465 detail lightweight_test.hpp for its own tests.
469 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
470 <td align="left"><p><small>Last revised: December 10, 2019 at 00:21:47 GMT</small></p></td>
471 <td align="right"><div class="copyright-footer"></div></td>
474 <div class="spirit-nav"><a accesskey="n" href="variadic_macro_data/vmd_naming.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>