Compare commits

...

10 Commits

10 changed files with 83 additions and 8 deletions

View File

@ -5,7 +5,7 @@
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="Docutils 0.3.8: http://docutils.sourceforge.net/" />
<title>Appendix A   An Introduction to Preprocessor Metaprogramming</title>
<title>Appendix A - An Introduction to Preprocessor Metaprogramming</title>
<meta name="copyright" content="From &quot;C++ Template Metaprogramming,&quot; by David Abrahams and Aleksey Gurtovoy. Copyright (c) 2005 by Pearson Education, Inc. Reprinted with permission." />
<style type="text/css">
@ -248,7 +248,7 @@ ul.auto-toc {
</style> </head>
<body><br />
<div class="document" id="preprocessor-title">
<h1 class="title">Appendix A   An Introduction to Preprocessor
<h1 class="title">Appendix A - An Introduction to Preprocessor
Metaprogramming</h1>
<table class="docinfo" frame="void" rules="none">
<colgroup><col class="docinfo-name" /> <col class="docinfo-content" />
@ -2491,4 +2491,4 @@ Although the formulation above will work, it does unnecessary workwhen ``n == 0`
</html>
<!--
FILE ARCHIVED ON 19:59:10 Mar 30, 2013 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 21:06:19 May 19, 2015. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)).-->
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)).-->

View File

@ -8,7 +8,7 @@
</style>
</head>
<body>
<h4><a href="Appendix%20A%20%C2%A0%20An%20Introduction%20to%20Preprocessor%20Metaprogramming.html"
<h4><a href="AppendixA-AnIntroductiontoPreprocessorMetaprogramming.html"
target="_top">Introduction</a></h4>
<h4><a href="topics.html">Topics</a></h4>
<a href="topics.html">

View File

@ -5,7 +5,7 @@
</head>
<body>
<div style="margin-left: 0px;">
The <b>facilities/identity.hpp</b> header defines a utility macro to use with <b>BOOST_PP_IF</b> and <b>BOOST_PP_IIF</b>.
The <b>facilities/identity.hpp</b> header defines utility macros to use with <b>BOOST_PP_IF</b> and <b>BOOST_PP_IIF</b>.
</div>
<h4>Usage</h4>
<div class="code">
@ -14,11 +14,13 @@
<h4>Contents</h4>
<ul>
<li><a href="../../ref/identity.html">BOOST_PP_IDENTITY</a></li>
<li><a href="../../ref/identity_n.html">BOOST_PP_IDENTITY_N</a></li>
</ul>
<hr size="1">
<div style="margin-left: 0px;">
<i><EFBFBD> Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
</br><i><EFBFBD> Copyright Paul Mensonides 2002</i>
</br><i><EFBFBD> Copyright Edward Diener 2015</i>
</div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0. (See

View File

@ -2,7 +2,7 @@
<title>tuple/enum.hpp</title>
<link rel="stylesheet" type="text/css" href="../../styles.css"></head><body>
<div style="margin-left: 0px;">
The <b>tuple/enum.hpp</b> header defines a macro to onvert a <i>tuple</i> to its comma-separated elements.
The <b>tuple/enum.hpp</b> header defines a macro to convert a <i>tuple</i> to its comma-separated elements.
</div>
<h4>Usage</h4>
<div class="code">

View File

@ -99,6 +99,7 @@
<li><a href="ref/greater_equal_d.html">GREATER_EQUAL_D</a></li>
<!-- I -->
<li><a href="ref/identity.html">IDENTITY</a></li>
<li><a href="ref/identity_n.html">IDENTITY_N</a></li>
<li><a href="ref/if.html">IF</a></li>
<li><a href="ref/iif.html">IIF</a></li>
<li><a href="ref/inc.html">INC</a></li>

58
doc/ref/identity_n.html Normal file
View File

@ -0,0 +1,58 @@
<html>
<head>
<title>BOOST_PP_IDENTITY_N</title>
<link rel="stylesheet" type="text/css" href="../styles.css">
</head>
<body>
<div style="margin-left: 0px;">
The <b>BOOST_PP_IDENTITY_N</b> macro expands to its first argument when invoked.
</div>
<h4>Usage</h4>
<div class="code">
<b>BOOST_PP_IDENTITY_N</b>(<i>item,n</i>)(n-arguments)
</div>
<h4>Arguments</h4>
<dl>
<dt>item</dt>
<dd>
The result of the expansion.
</dd>
<dt>n</dt>
<dd>
The number of arguments when invoked.
</dd>
</dl>
<h4>Remarks</h4>
<div>
This macro is designed to be used with <b>BOOST_PP_IF</b> and <b>BOOST_PP_IIF</b> when only one of the clauses needs to be invoked.
</div>
<h4>See Also</h4>
<ul>
<li><a href="if.html">BOOST_PP_IF</a></li>
<li><a href="iif.html">BOOST_PP_IIF</a></li>
</ul>
<h4>Requirements</h4>
<div>
<b>Header:</b> &nbsp;<a href="../headers/facilities/identity_n.html">&lt;boost/preprocessor/facilities/identity.hpp&gt;</a>
</div>
<h4>Sample Code</h4>
<div><pre>
#include &lt;<a href="../headers/control/if.html">boost/preprocessor/control/if.hpp</a>&gt;
#include &lt;<a href="../headers/facilities/identity.html">boost/preprocessor/facilities/identity.hpp</a>&gt;
#define MACRO_CAT(y,z) y ## z
#define MACRO(n) <a href="if.html">BOOST_PP_IF</a>(n, <a href="identity_n.html">BOOST_PP_IDENTITY_N</a>(x,2), MACRO_CAT)(a,b)
MACRO(0) // expands to ab
MACRO(1) // expands to x
</pre></div>
<hr size="1">
<div style="margin-left: 0px"><i>&copy; Copyright Edward Diener 2015</i></div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0. (See
accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body>
</html>

View File

@ -12,7 +12,7 @@
may be used as a standalone library. </div>
<div> An excerpt from <i>C++ Template Metaprogramming: Concepts, Tools, and
Techniques from Boost and Beyond</i> by Dave Abrahams and Aleksey
Gurtovoy has been made <a href="Appendix%20A%20%C2%A0%20An%20Introduction%20to%20Preprocessor%20Metaprogramming.html"
Gurtovoy has been made <a href="AppendixA-AnIntroductiontoPreprocessorMetaprogramming.html"
target="_top"><font color="blue"><b><u><i>available</i></u></b></font></a>.
This excerpt contains a basic introduction to the Preprocessor library and
preprocessor metaprogramming which may help users new to the library and

View File

@ -8,6 +8,7 @@
# */
#
# /* Revised by Paul Mensonides (2002) */
# /* Revised by Edward Diener (2015) */
#
# /* See http://www.boost.org for most recent version. */
#
@ -15,9 +16,12 @@
# define BOOST_PREPROCESSOR_FACILITIES_IDENTITY_HPP
#
# include <boost/preprocessor/facilities/empty.hpp>
# include <boost/preprocessor/tuple/eat.hpp>
#
# /* BOOST_PP_IDENTITY */
#
# define BOOST_PP_IDENTITY(item) item BOOST_PP_EMPTY
#
# define BOOST_PP_IDENTITY_N(item,n) item BOOST_PP_TUPLE_EAT_N(n)
#
# endif

View File

@ -8,7 +8,7 @@
# */
#
# /* Revised by Paul Mensonides (2002-2011) */
# /* Revised by Edward Diener (2011) */
# /* Revised by Edward Diener (2011,2015) */
#
# /* See http://www.boost.org for most recent version. */
#
@ -38,6 +38,15 @@
# endif
# define BOOST_PP_TUPLE_EAT_I(size) BOOST_PP_TUPLE_EAT_ ## size
# endif
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
# define BOOST_PP_TUPLE_EAT_N(size) BOOST_PP_TUPLE_EAT_N_I(size)
# else
# define BOOST_PP_TUPLE_EAT_N(size) BOOST_PP_TUPLE_EAT_N_OO((size))
# define BOOST_PP_TUPLE_EAT_N_OO(par) BOOST_PP_TUPLE_EAT_N_I ## par
# endif
# define BOOST_PP_TUPLE_EAT_N_I(size) BOOST_PP_TUPLE_EAT_ ## size
#
# define BOOST_PP_TUPLE_EAT_1(e0)
# define BOOST_PP_TUPLE_EAT_2(e0, e1)
# define BOOST_PP_TUPLE_EAT_3(e0, e1, e2)

View File

@ -26,6 +26,7 @@ BEGIN BOOST_PP_APPLY((BOOST_PP_EMPTY))() 0 == 0 END
BEGIN BOOST_PP_EXPAND(MACRO ARGS) == 1 END
BEGIN BOOST_PP_IDENTITY(1)() == 1 END
BEGIN BOOST_PP_IDENTITY_N(36,10)(0,1,2,3,4,5,6,7,8,9) == 36 END
BEGIN BOOST_PP_CAT(BOOST_PP_INTERCEPT, 2) 1 == 1 END