3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Input as dynamic types</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="up" href="../index.html" title="Chapter 1. The Variadic Macro Data Library 1.9">
9 <link rel="prev" href="vmd_reentrant.html" title="Boost PP re-entrant versions">
10 <link rel="next" href="vmd_vc_isms.html" title="Visual C++ gotchas in VMD">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="vmd_reentrant.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="vmd_vc_isms.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
27 <a name="variadic_macro_data.vmd_dynamic_typing"></a><a class="link" href="vmd_dynamic_typing.html" title="Input as dynamic types">Input as dynamic
29 </h2></div></div></div>
31 Within the constraints based on the top-level types which VMD can parse, the
32 libraries gives the end-user the ability to design macros with dynamic data
33 types. By this I mean that a macro could be designed to handle different data
34 types based on some documented agreement of different combinations of macro
35 input meaning slightly different things. Add to this the ability to design
36 such macros with variadic parameters and we have a preprocessor system of macro
37 creation which to a lesser extent rivals the DSELS of template metaprogramming.
38 Of course the preprocessor is not nearly as flexible as C++ templates, but
39 still the sort of preprocessor metaprogramming one could do with VMD, and the
40 underlying Boost PP, in creating flexible macros which can handle different
41 combinations of data types is very interesting.
44 Of course macros need to be usable by an end-user so the syntactical ability
45 of sequences to represent different types of input data must be balanced against
46 ease of use and understanding when using a macro. But because certain sequences
47 can mimic C++ function calls to some extent it is possible to represent macros
48 as a language closer to C++ with VMD.
51 What is important when designing a macro in which you parse input to decide
52 which type of data the invoker is passing to your macro is that you are aware
53 of the constraints when parsing a data type. As an example if you design a
54 macro where some input can either be a number, an identifier, or some other
55 data type top-level input then attempting to parse the data to see if it is
56 a number or identifier could fail with a preprocessor error and nullify your
57 design if the data is not a VMD data type. So designing a macro with data types
58 in mind often means restricting data to parseable top-level types.
61 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
62 <td align="left"></td>
63 <td align="right"><div class="copyright-footer">Copyright © 2010-2017 Tropic Software
67 <div class="spirit-nav">
68 <a accesskey="p" href="vmd_reentrant.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="vmd_vc_isms.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>