Using private detail CAT to avoid DELAY macros

[SVN r14147]
This commit is contained in:
Vesa Karvonen
2002-06-14 20:38:54 +00:00
parent 5e0488f509
commit 54d0da5221
10 changed files with 57 additions and 34 deletions

View File

@ -13,18 +13,19 @@
* See http://www.boost.org for most recent version.
*/
#include <boost/preprocessor/detail/cat.hpp>
/** <p>Expands to <code>0</code> if <code>X == 0</code> and <code>1</code> if <code>X != 0</code>.</p>
<p><code>X</code> must be an integer literal in the range [0, BOOST_PP_LIMIT_MAG].</p>
<p>For example, <code>BOOST_PP_BOOL(3)</code> expands to <code>1</code>.</p>
*/
#define BOOST_PP_BOOL(X) BOOST_PP_BOOL_DELAY(X)
#define BOOST_PP_BOOL(X) BOOST_PP_DETAIL_CAT2(BOOST_PP_BOOL,X)
/* BOOL can be implemented in O(1) tokens using saturated ADD & SUB.
* Unfortunately, it would result in significantly slower preprocessing.
*/
#define BOOST_PP_BOOL_DELAY(X) BOOST_PP_BOOL##X
#define BOOST_PP_BOOL0 0
#define BOOST_PP_BOOL1 1
#define BOOST_PP_BOOL2 1

View File

@ -13,6 +13,7 @@
* See http://www.boost.org for most recent version.
*/
#include <boost/preprocessor/detail/cat.hpp>
#include <boost/preprocessor/logical/bool.hpp>
/** <p>Expands to the logical NEITHER OR of the operands.</p>
@ -27,12 +28,10 @@ in the range [0, BOOST_PP_LIMIT_MAG].</p>
<li><a href="../../test/logical_test.cpp">logical_test.cpp</a></li>
</ul>
*/
#define BOOST_PP_NOR(X,Y) BOOST_PP_NOR_BOOL(BOOST_PP_BOOL(X),BOOST_PP_BOOL(Y))
#define BOOST_PP_NOR(X,Y) BOOST_PP_DETAIL_CAT3(BOOST_PP_NOR,BOOST_PP_BOOL(X),BOOST_PP_BOOL(Y))
#define BOOST_PP_NOR_BOOL(X,Y) BOOST_PP_NOR_BOOL_DELAY(X,Y)
#define BOOST_PP_NOR_BOOL_DELAY(X,Y) BOOST_PP_NOR_BOOL##X##Y
#define BOOST_PP_NOR_BOOL00 1
#define BOOST_PP_NOR_BOOL01 0
#define BOOST_PP_NOR_BOOL10 0
#define BOOST_PP_NOR_BOOL11 0
#define BOOST_PP_NOR00 1
#define BOOST_PP_NOR01 0
#define BOOST_PP_NOR10 0
#define BOOST_PP_NOR11 0
#endif