From 02ab183b968d56d1d4640df09f6d77f046ff5fb2 Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Sun, 13 Sep 2015 13:21:57 -0400 Subject: [PATCH] Added documentation for identity_n macro. --- doc/headers/facilities/identity.html | 4 +- doc/ref.html | 1 + doc/ref/identity_n.html | 58 ++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 doc/ref/identity_n.html diff --git a/doc/headers/facilities/identity.html b/doc/headers/facilities/identity.html index 9478e09..af9034b 100644 --- a/doc/headers/facilities/identity.html +++ b/doc/headers/facilities/identity.html @@ -5,7 +5,7 @@
- The facilities/identity.hpp header defines a utility macro to use with BOOST_PP_IF and BOOST_PP_IIF. + The facilities/identity.hpp header defines utility macros to use with BOOST_PP_IF and BOOST_PP_IIF.

Usage

@@ -14,11 +14,13 @@

Contents


© Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002 +
© Copyright Edward Diener 2015

Distributed under the Boost Software License, Version 1.0. (See diff --git a/doc/ref.html b/doc/ref.html index 4d2081f..102325a 100644 --- a/doc/ref.html +++ b/doc/ref.html @@ -99,6 +99,7 @@

  • GREATER_EQUAL_D
  • IDENTITY
  • +
  • IDENTITY_N
  • IF
  • IIF
  • INC
  • diff --git a/doc/ref/identity_n.html b/doc/ref/identity_n.html new file mode 100644 index 0000000..0c01dd3 --- /dev/null +++ b/doc/ref/identity_n.html @@ -0,0 +1,58 @@ + + + BOOST_PP_IDENTITY_N + + + +
    + The BOOST_PP_IDENTITY_N macro expands to its first argument when invoked. +
    +

    Usage

    +
    + BOOST_PP_IDENTITY_N(item,n)(n-arguments) +
    +

    Arguments

    +
    +
    item
    +
    + The result of the expansion. +
    +
    n
    +
    + The number of arguments when invoked. +
    +
    +

    Remarks

    +
    + This macro is designed to be used with BOOST_PP_IF and BOOST_PP_IIF when only one of the clauses needs to be invoked. +
    +

    See Also

    + +

    Requirements

    +
    + Header:  <boost/preprocessor/facilities/identity.hpp> +
    +

    Sample Code

    +
    +#include <boost/preprocessor/control/if.hpp>
    +#include <boost/preprocessor/facilities/identity.hpp>
    +
    +#define MACRO_CAT(y,z) y ## z
    +#define MACRO(n) BOOST_PP_IF(n, BOOST_PP_IDENTITY_N(x,2), MACRO_CAT)(a,b)
    +
    +MACRO(0) // expands to ab
    +MACRO(1) // expands to x
    +
    +
    +
    © Copyright Edward Diener 2015
    +
    +

    Distributed under the Boost Software License, Version 1.0. (See + accompanying file LICENSE_1_0.txt or + copy at www.boost.org/LICENSE_1_0.txt)

    +
    + +