From b9411f807f8a13ed3f59da5b827f62fc66d50dac Mon Sep 17 00:00:00 2001
From: Lorenzo Caminiti
Table of Contents
- This library allows to wrap type expressions within round parenthesis so they - can be passed to macros even when they contain commas. + This library allows to wrap types within round parenthesis so they can always + be passed as macro parameters.
Consider the following macro which declares a variable named var
n
with the specified type
(see also
@@ -236,7 +236,7 @@
BOOST_IDENTITY_TYPE(parenthesized_type)
BOOST_IDENTITY_TYPE — This macro allows to wrap the specified type expression within extra round parenthesis so the type can be passed as a single macro parameter even if it contains commas (not already wrapped within round parenthesis).
// In header: <boost/utility/identity_type.hpp>
-BOOST_IDENTITY_TYPE(parenthesized_type)
Parameters:
parenthesized_type | The type expression to be passed as macro parameter wrapped by a single set of round parenthesis (...) . This type expression can contain an arbitrary number of commas. |
+BOOST_IDENTITY_TYPE(parenthesized_type)
Parameters:
parenthesized_type | The type expression to be passed as macro parameter wrapped by a single set of round parenthesis (...) . This type expression can contain an arbitrary number of commas. |
This macro works on any C++03 compiler (it does not use variadic macros).
This macro must be prefixed by typename
when used within templates. Note that the compiler will not be able to automatically determine function template parameters when they are wrapped with this macro (these parameters need to be explicitly specified when calling the function template).
On some compilers (like GCC), using this macro on abstract types requires to add and remove a reference to the specified type.
[1]
Using variadic macros, it would be possible to require a single set of extra
parenthesis BOOST_IDENTITY_TYPE(
type
)
instead of two BOOST_IDENTITY_TYPE((
type
))
but variadic macros are not part of C++03
diff --git a/identity_type/doc/identity_type.qbk b/identity_type/doc/identity_type.qbk
index ede7510..1c97616 100644
--- a/identity_type/doc/identity_type.qbk
+++ b/identity_type/doc/identity_type.qbk
@@ -19,7 +19,7 @@
[category Utilities]
]
-This library allows to wrap type expressions within round parenthesis so they can be passed to macros even when they contain commas.
+This library allows to wrap types within round parenthesis so they can always be passed as macro parameters.
[import ../test/var_error.cpp]
[import ../test/var.cpp]