summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/foreach.hpp')
-rw-r--r--3rdParty/Boost/src/boost/foreach.hpp54
1 files changed, 39 insertions, 15 deletions
diff --git a/3rdParty/Boost/src/boost/foreach.hpp b/3rdParty/Boost/src/boost/foreach.hpp
index db5b203..571b45c 100644
--- a/3rdParty/Boost/src/boost/foreach.hpp
+++ b/3rdParty/Boost/src/boost/foreach.hpp
@@ -15,6 +15,7 @@
// Alisdair Meredith - For help porting to Borland
// Stefan Slapeta - For help porting to Intel
// David Jenkins - For help finding a Microsoft Code Analysis bug
+// mimomorin@... - For a patch to use rvalue refs on supporting compilers
#ifndef BOOST_FOREACH
@@ -30,8 +31,10 @@
#include <boost/detail/workaround.hpp>
// Some compilers let us detect even const-qualified rvalues at compile-time
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \
- || (BOOST_WORKAROUND(__GNUC__, >= 4) && !defined(BOOST_INTEL) && !defined(BOOST_CLANG)) \
+#if !defined(BOOST_NO_RVALUE_REFERENCES) \
+ || BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \
+ || (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) && \
+ !defined(BOOST_CLANG)) \
|| (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL) && \
!defined(BOOST_CLANG))
# define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION
@@ -80,6 +83,7 @@
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_abstract.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
+#include <boost/type_traits/is_rvalue_reference.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/utility/addressof.hpp>
#include <boost/foreach_fwd.hpp>
@@ -214,12 +218,6 @@ template<typename Bool1>
inline boost::mpl::not_<Bool1> *not_(Bool1 *) { return 0; }
template<typename T>
-inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; }
-
-template<typename T>
-inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; }
-
-template<typename T>
inline boost::is_array<T> *is_array_(T const &) { return 0; }
template<typename T>
@@ -230,6 +228,17 @@ template<typename T>
inline boost::mpl::true_ *is_const_(T const &) { return 0; }
#endif
+#ifdef BOOST_NO_RVALUE_REFERENCES
+template<typename T>
+inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; }
+
+template<typename T>
+inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; }
+#else
+template<typename T>
+inline boost::is_rvalue_reference<T &&> *is_rvalue_(T &&, int) { return 0; }
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// auto_any_t/auto_any
// General utility for putting an object of any type into automatic storage
@@ -428,7 +437,6 @@ inline T (*&to_ptr(T (&)[N]))[N]
static T (*t)[N] = 0;
return t;
}
-#endif
///////////////////////////////////////////////////////////////////////////////
// derefof
@@ -445,7 +453,23 @@ inline T &derefof(T *t)
);
}
-#ifdef BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION
+# define BOOST_FOREACH_DEREFOF(T) boost::foreach_detail_::derefof(*T)
+#else
+# define BOOST_FOREACH_DEREFOF(T) (*T)
+#endif
+
+#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \
+ && !defined(BOOST_NO_RVALUE_REFERENCES)
+///////////////////////////////////////////////////////////////////////////////
+// Rvalue references makes it drop-dead simple to detect at compile time
+// whether an expression is an rvalue.
+///////////////////////////////////////////////////////////////////////////////
+
+# define BOOST_FOREACH_IS_RVALUE(COL) \
+ boost::foreach_detail_::is_rvalue_((COL), 0)
+
+#elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \
+ && defined(BOOST_NO_RVALUE_REFERENCES)
///////////////////////////////////////////////////////////////////////////////
// Detect at compile-time whether an expression yields an rvalue or
// an lvalue. This is rather non-standard, but some popular compilers
@@ -647,7 +671,7 @@ begin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue
typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type;
typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator;
return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>(
- iterator(boost::begin(derefof(auto_any_cast<type *, boost::mpl::false_>(col)))));
+ iterator(boost::begin(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col))))));
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -687,7 +711,7 @@ end(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue
typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type;
typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator;
return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>(
- iterator(boost::end(derefof(auto_any_cast<type *, boost::mpl::false_>(col)))));
+ iterator(boost::end(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col))))));
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -766,7 +790,7 @@ rbegin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue
typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type;
typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator;
return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>(
- iterator(boost::rbegin(derefof(auto_any_cast<type *, boost::mpl::false_>(col)))));
+ iterator(boost::rbegin(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col))))));
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -809,7 +833,7 @@ rend(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue
typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type;
typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator;
return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>(
- iterator(boost::rend(derefof(auto_any_cast<type *, boost::mpl::false_>(col)))));
+ iterator(boost::rend(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col))))));
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
@@ -902,7 +926,7 @@ rderef(auto_any_t cur, type2type<T, C> *)
boost::foreach_detail_::to_ptr(COL) \
, boost_foreach_argument_dependent_lookup_hack_value))
-#ifdef BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION
+#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION)
///////////////////////////////////////////////////////////////////////////////
// R-values and const R-values supported here with zero runtime overhead
///////////////////////////////////////////////////////////////////////////////