2001-11-25 18:32:11 +00:00
|
|
|
#ifndef BOOST_PREPROCESSOR_CAT_HPP
|
|
|
|
#define BOOST_PREPROCESSOR_CAT_HPP
|
|
|
|
|
2002-01-29 14:13:10 +00:00
|
|
|
/* Copyright (C) 2001
|
|
|
|
* Housemarque Oy
|
|
|
|
* http://www.housemarque.com
|
|
|
|
*
|
|
|
|
* Permission to copy, use, modify, sell and distribute this software is
|
|
|
|
* granted provided this copyright notice appears in all copies. This
|
|
|
|
* software is provided "as is" without express or implied warranty, and
|
|
|
|
* with no claim as to its suitability for any purpose.
|
|
|
|
*
|
|
|
|
* See http://www.boost.org for most recent version.
|
|
|
|
*/
|
2001-11-25 18:32:11 +00:00
|
|
|
|
2002-01-31 14:21:31 +00:00
|
|
|
/** <P>Delays the catenation of X and Y.</P>
|
2001-11-25 18:32:11 +00:00
|
|
|
|
2002-01-31 14:21:31 +00:00
|
|
|
<P>For example,</P>
|
2001-11-25 18:32:11 +00:00
|
|
|
|
2002-01-31 14:21:31 +00:00
|
|
|
<PRE>
|
2001-11-25 18:32:11 +00:00
|
|
|
#define STATIC_ASSERT(EXPR)\
|
|
|
|
enum\
|
2001-12-28 11:06:53 +00:00
|
|
|
{ BOOST_PP_CAT(static_check_,__LINE__) = (EXPR) ? 1 : -1\
|
2001-11-25 18:32:11 +00:00
|
|
|
};\
|
|
|
|
typedef char\
|
2001-12-28 11:06:53 +00:00
|
|
|
BOOST_PP_CAT(static_assert_,__LINE__)\
|
|
|
|
[ BOOST_PP_CAT(static_check_,__LINE__)\
|
2001-11-25 18:32:11 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
// ...
|
|
|
|
|
|
|
|
STATIC_ASSERT(sizeof(int) <= sizeof(long));
|
2002-01-31 14:21:31 +00:00
|
|
|
</PRE>
|
2001-11-25 18:32:11 +00:00
|
|
|
|
2002-01-31 14:21:31 +00:00
|
|
|
<P>expands to:</P>
|
2001-11-25 18:32:11 +00:00
|
|
|
|
2002-01-31 14:21:31 +00:00
|
|
|
<PRE>
|
2001-11-25 18:32:11 +00:00
|
|
|
enum
|
|
|
|
{ static_check_152 = (sizeof(int) <= sizeof(long)) ? 1 : -1
|
|
|
|
};
|
|
|
|
typedef char
|
|
|
|
static_assert_152
|
|
|
|
[ static_check_152
|
|
|
|
];
|
2002-01-31 14:21:31 +00:00
|
|
|
</PRE>
|
2001-11-25 18:32:11 +00:00
|
|
|
|
2002-01-31 14:21:31 +00:00
|
|
|
<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>
|
2001-11-25 18:32:11 +00:00
|
|
|
|
2002-01-31 14:21:31 +00:00
|
|
|
<PRE>
|
2001-11-25 18:32:11 +00:00
|
|
|
enum
|
|
|
|
{ static_check___LINE__ = (sizeof(int) <= sizeof(long)) ? 1 : -1
|
|
|
|
};
|
|
|
|
typedef char
|
|
|
|
static_assert___LINE__
|
|
|
|
[ static_check___LINE__
|
|
|
|
];
|
2002-01-31 14:21:31 +00:00
|
|
|
</PRE>
|
2001-11-25 18:32:11 +00:00
|
|
|
*/
|
2002-01-22 13:32:06 +00:00
|
|
|
#define BOOST_PP_CAT(X,Y) BOOST_PP_CAT_DELAY(X,Y)
|
2001-11-25 18:32:11 +00:00
|
|
|
|
|
|
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
2002-01-22 13:32:06 +00:00
|
|
|
#define BOOST_PP_CAT_DELAY(X,Y) BOOST_PP_DO_CAT(X,Y)
|
|
|
|
#define BOOST_PP_DO_CAT(X,Y) X##Y
|
2001-12-28 11:06:53 +00:00
|
|
|
#endif
|
|
|
|
|
2002-01-31 14:21:31 +00:00
|
|
|
/** <P>Obsolete. Use BOOST_PP_CAT().</P> */
|
2002-01-22 13:32:06 +00:00
|
|
|
#define BOOST_PREPROCESSOR_CAT(X,Y) BOOST_PP_CAT(X,Y)
|
2001-11-25 18:32:11 +00:00
|
|
|
#endif
|