forked from boostorg/preprocessor
Updated docs
[SVN r12687]
This commit is contained in:
@ -13,50 +13,13 @@
|
||||
* See http://www.boost.org for most recent version.
|
||||
*/
|
||||
|
||||
/** <P>Delays the catenation of X and Y.</P>
|
||||
/** <p>Concatenates <code>X</code> and <code>Y</code> after they are macro
|
||||
expanded.</p>
|
||||
|
||||
<P>For example,</P>
|
||||
|
||||
<PRE>
|
||||
#define STATIC_ASSERT(EXPR)\
|
||||
enum\
|
||||
{ BOOST_PP_CAT(static_check_,__LINE__) = (EXPR) ? 1 : -1\
|
||||
};\
|
||||
typedef char\
|
||||
BOOST_PP_CAT(static_assert_,__LINE__)\
|
||||
[ BOOST_PP_CAT(static_check_,__LINE__)\
|
||||
]
|
||||
|
||||
// ...
|
||||
|
||||
STATIC_ASSERT(sizeof(int) <= sizeof(long));
|
||||
</PRE>
|
||||
|
||||
<P>expands to:</P>
|
||||
|
||||
<PRE>
|
||||
enum
|
||||
{ static_check_152 = (sizeof(int) <= sizeof(long)) ? 1 : -1
|
||||
};
|
||||
typedef char
|
||||
static_assert_152
|
||||
[ static_check_152
|
||||
];
|
||||
</PRE>
|
||||
|
||||
<P>Using BOOST_PP_CAT() above lets the PP expand the __LINE__. If the above
|
||||
code would use the ## operator directly then __LINE__ would not be expanded and
|
||||
the above would expand to:</P>
|
||||
|
||||
<PRE>
|
||||
enum
|
||||
{ static_check___LINE__ = (sizeof(int) <= sizeof(long)) ? 1 : -1
|
||||
};
|
||||
typedef char
|
||||
static_assert___LINE__
|
||||
[ static_check___LINE__
|
||||
];
|
||||
</PRE>
|
||||
<h3>Example</h3>
|
||||
<ul>
|
||||
<li><a href="../../example/static_assert.c">static_assert.c</a></li>
|
||||
</ul>
|
||||
*/
|
||||
#define BOOST_PP_CAT(X,Y) BOOST_PP_CAT_DELAY(X,Y)
|
||||
|
||||
@ -65,6 +28,6 @@ the above would expand to:</P>
|
||||
#define BOOST_PP_DO_CAT(X,Y) X##Y
|
||||
#endif
|
||||
|
||||
/** <P>Obsolete. Use BOOST_PP_CAT().</P> */
|
||||
/** <p>Obsolete. Use BOOST_PP_CAT().</p> */
|
||||
#define BOOST_PREPROCESSOR_CAT(X,Y) BOOST_PP_CAT(X,Y)
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user