3030#include < boost/config.hpp>
3131#include < boost/detail/workaround.hpp>
3232
33+ // Define a compiler generic null pointer value
34+ #if defined(BOOST_NO_NULLPTR)
35+ #define BOOST_FOREACH_NULL 0
36+ #else
37+ #define BOOST_FOREACH_NULL nullptr
38+ #endif
39+
3340// Some compilers let us detect even const-qualified rvalues at compile-time
3441#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \
3542 || defined (BOOST_MSVC) && !defined (_PREFAST_) \
@@ -909,7 +916,7 @@ rderef(auto_any_t cur, type2type<T, C> *)
909916
910917// A sneaky way to get the type of the collection without evaluating the expression
911918#define BOOST_FOREACH_TYPEOF (COL ) \
912- (true ? 0 : boost::foreach_detail_::encode_type(COL, boost::foreach_detail_::is_const_(COL)))
919+ (true ? BOOST_FOREACH_NULL : boost::foreach_detail_::encode_type(COL, boost::foreach_detail_::is_const_(COL)))
913920
914921// returns true_* if the type is noncopyable
915922#define BOOST_FOREACH_IS_NONCOPYABLE (COL ) \
@@ -939,7 +946,7 @@ rderef(auto_any_t cur, type2type<T, C> *)
939946 (COL)
940947
941948# define BOOST_FOREACH_SHOULD_COPY (COL ) \
942- (true ? 0 : boost::foreach_detail_::or_( \
949+ (true ? BOOST_FOREACH_NULL : boost::foreach_detail_::or_( \
943950 BOOST_FOREACH_IS_RVALUE (COL) \
944951 , BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL)))
945952
@@ -962,11 +969,11 @@ rderef(auto_any_t cur, type2type<T, C> *)
962969// If the type happens to be a lightweight proxy, always make a copy.
963970# define BOOST_FOREACH_SHOULD_COPY (COL ) \
964971 (boost::foreach_detail_::should_copy_impl( \
965- true ? 0 : boost::foreach_detail_::or_( \
972+ true ? BOOST_FOREACH_NULL : boost::foreach_detail_::or_( \
966973 boost::foreach_detail_::is_array_ (COL) \
967974 , BOOST_FOREACH_IS_NONCOPYABLE(COL) \
968975 , boost::foreach_detail_::not_(boost::foreach_detail_::is_const_(COL))) \
969- , true ? 0 : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL) \
976+ , true ? BOOST_FOREACH_NULL : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL) \
970977 , &BOOST_FOREACH_ID(_foreach_is_rvalue)))
971978
972979#elif !defined(BOOST_FOREACH_NO_RVALUE_DETECTION)
@@ -985,7 +992,7 @@ rderef(auto_any_t cur, type2type<T, C> *)
985992// Determine whether the collection expression is an lvalue or an rvalue.
986993// NOTE: this gets the answer wrong for const rvalues.
987994# define BOOST_FOREACH_SHOULD_COPY (COL ) \
988- (true ? 0 : boost::foreach_detail_::or_( \
995+ (true ? BOOST_FOREACH_NULL : boost::foreach_detail_::or_( \
989996 boost::foreach_detail_::is_rvalue_ ((COL), 0) \
990997 , BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL)))
991998
@@ -1004,7 +1011,7 @@ rderef(auto_any_t cur, type2type<T, C> *)
10041011
10051012// Can't use rvalues with BOOST_FOREACH (unless they are lightweight proxies)
10061013# define BOOST_FOREACH_SHOULD_COPY (COL ) \
1007- (true ? 0 : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL))
1014+ (true ? BOOST_FOREACH_NULL : BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(COL))
10081015
10091016#endif
10101017
0 commit comments