diff options
Diffstat (limited to '3rdParty/Boost/src/boost/operators.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/operators.hpp | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/3rdParty/Boost/src/boost/operators.hpp b/3rdParty/Boost/src/boost/operators.hpp index b524cee..82c374e 100644 --- a/3rdParty/Boost/src/boost/operators.hpp +++ b/3rdParty/Boost/src/boost/operators.hpp @@ -65,78 +65,71 @@ // documentation for the details). Unfortunately, a straightforward // implementation of this change would have broken compatibility with the // previous version of the library by making it impossible to use the same // template name (e.g. 'addable') for both the 1- and 2-argument versions of // an operator template. This implementation solves the backward-compatibility // issue at the cost of some simplicity. // // One of the complications is an existence of special auxiliary class template // 'is_chained_base<>' (see 'detail' namespace below), which is used // to determine whether its template parameter is a library's operator template // or not. You have to specialize 'is_chained_base<>' for each new // operator template you add to the library. // // However, most of the non-trivial implementation details are hidden behind // several local macros defined below, and as soon as you understand them, // you understand the whole library implementation. #ifndef BOOST_OPERATORS_HPP #define BOOST_OPERATORS_HPP #include <boost/config.hpp> #include <boost/iterator.hpp> #include <boost/detail/workaround.hpp> #if defined(__sgi) && !defined(__GNUC__) # pragma set woff 1234 #endif #if BOOST_WORKAROUND(BOOST_MSVC, < 1600) # pragma warning( disable : 4284 ) // complaint about return type of #endif // operator-> not begin a UDT namespace boost { namespace detail { -template <typename T> class empty_base { - -// Helmut Zeisel, empty base class optimization bug with GCC 3.0.0 -#if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==0 && __GNU_PATCHLEVEL__==0 - bool dummy; -#endif - -}; +template <typename T> class empty_base {}; } // namespace detail } // namespace boost // In this section we supply the xxxx1 and xxxx2 forms of the operator // templates, which are explicitly targeted at the 1-type-argument and // 2-type-argument operator forms, respectively. Some compilers get confused // when inline friend functions are overloaded in namespaces other than the // global namespace. When BOOST_NO_OPERATORS_IN_NAMESPACE is defined, all of // these templates must go in the global namespace. #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE namespace boost { #endif // Basic operator classes (contributed by Dave Abrahams) ------------------// // Note that friend functions defined in a class are implicitly inline. // See the C++ std, 11.4 [class.friend] paragraph 5 template <class T, class U, class B = ::boost::detail::empty_base<T> > struct less_than_comparable2 : B { friend bool operator<=(const T& x, const U& y) { return !static_cast<bool>(x > y); } friend bool operator>=(const T& x, const U& y) { return !static_cast<bool>(x < y); } friend bool operator>(const U& x, const T& y) { return y < x; } friend bool operator<(const U& x, const T& y) { return y > x; } friend bool operator<=(const U& x, const T& y) { return !static_cast<bool>(y < x); } friend bool operator>=(const U& x, const T& y) { return !static_cast<bool>(y > x); } }; template <class T, class B = ::boost::detail::empty_base<T> > struct less_than_comparable1 : B { @@ -679,71 +672,70 @@ struct random_access_iteratable # define BOOST_IMPORT_TEMPLATE4(template_name) using ::template_name; # define BOOST_IMPORT_TEMPLATE3(template_name) using ::template_name; # define BOOST_IMPORT_TEMPLATE2(template_name) using ::template_name; # define BOOST_IMPORT_TEMPLATE1(template_name) using ::template_name; # else // Otherwise, because a Borland C++ 5.5 bug prevents a using declaration // from working, we are forced to use inheritance for that compiler. # define BOOST_IMPORT_TEMPLATE4(template_name) \ template <class T, class U, class V, class W, class B = ::boost::detail::empty_base<T> > \ struct template_name : ::template_name<T, U, V, W, B> {}; # define BOOST_IMPORT_TEMPLATE3(template_name) \ template <class T, class U, class V, class B = ::boost::detail::empty_base<T> > \ struct template_name : ::template_name<T, U, V, B> {}; # define BOOST_IMPORT_TEMPLATE2(template_name) \ template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct template_name : ::template_name<T, U, B> {}; # define BOOST_IMPORT_TEMPLATE1(template_name) \ template <class T, class B = ::boost::detail::empty_base<T> > \ struct template_name : ::template_name<T, B> {}; # endif // BOOST_NO_USING_TEMPLATE #endif // BOOST_NO_OPERATORS_IN_NAMESPACE // // Here's where we put it all together, defining the xxxx forms of the templates // in namespace boost. We also define specializations of is_chained_base<> for // the xxxx, xxxx1, and xxxx2 templates, importing them into boost:: as // necessary. // -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // is_chained_base<> - a traits class used to distinguish whether an operator // template argument is being used for base class chaining, or is specifying a // 2nd argument type. namespace boost { // A type parameter is used instead of a plain bool because Borland's compiler // didn't cope well with the more obvious non-type template parameter. namespace detail { struct true_t {}; struct false_t {}; } // namespace detail // Unspecialized version assumes that most types are not being used for base // class chaining. We specialize for the operator templates defined in this // library. template<class T> struct is_chained_base { typedef ::boost::detail::false_t value; }; } // namespace boost // Import a 4-type-argument operator template into boost (if necessary) and // provide a specialization of 'is_chained_base<>' for it. # define BOOST_OPERATOR_TEMPLATE4(template_name4) \ BOOST_IMPORT_TEMPLATE4(template_name4) \ template<class T, class U, class V, class W, class B> \ struct is_chained_base< ::boost::template_name4<T, U, V, W, B> > { \ typedef ::boost::detail::true_t value; \ }; // Import a 3-type-argument operator template into boost (if necessary) and // provide a specialization of 'is_chained_base<>' for it. # define BOOST_OPERATOR_TEMPLATE3(template_name3) \ BOOST_IMPORT_TEMPLATE3(template_name3) \ @@ -777,166 +769,144 @@ template<class T> struct is_chained_base { // argument forms. // // The template type parameter O == is_chained_base<U>::value is used to // distinguish whether the 2nd argument to <template_name> is being used for // base class chaining from another boost operator template or is describing a // 2nd operand type. O == true_t only when U is actually an another operator // template from the library. Partial specialization is used to select an // implementation in terms of either '<template_name>1' or '<template_name>2'. // # define BOOST_OPERATOR_TEMPLATE(template_name) \ template <class T \ ,class U = T \ ,class B = ::boost::detail::empty_base<T> \ ,class O = typename is_chained_base<U>::value \ > \ struct template_name : template_name##2<T, U, B> {}; \ \ template<class T, class U, class B> \ struct template_name<T, U, B, ::boost::detail::true_t> \ : template_name##1<T, U> {}; \ \ template <class T, class B> \ struct template_name<T, T, B, ::boost::detail::false_t> \ : template_name##1<T, B> {}; \ \ template<class T, class U, class B, class O> \ struct is_chained_base< ::boost::template_name<T, U, B, O> > { \ typedef ::boost::detail::true_t value; \ }; \ \ BOOST_OPERATOR_TEMPLATE2(template_name##2) \ BOOST_OPERATOR_TEMPLATE1(template_name##1) -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -# define BOOST_OPERATOR_TEMPLATE4(template_name4) \ - BOOST_IMPORT_TEMPLATE4(template_name4) -# define BOOST_OPERATOR_TEMPLATE3(template_name3) \ - BOOST_IMPORT_TEMPLATE3(template_name3) -# define BOOST_OPERATOR_TEMPLATE2(template_name2) \ - BOOST_IMPORT_TEMPLATE2(template_name2) -# define BOOST_OPERATOR_TEMPLATE1(template_name1) \ - BOOST_IMPORT_TEMPLATE1(template_name1) - - // In this case we can only assume that template_name<> is equivalent to the - // more commonly needed template_name1<> form. -# define BOOST_OPERATOR_TEMPLATE(template_name) \ - template <class T, class B = ::boost::detail::empty_base<T> > \ - struct template_name : template_name##1<T, B> {}; - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace boost { BOOST_OPERATOR_TEMPLATE(less_than_comparable) BOOST_OPERATOR_TEMPLATE(equality_comparable) BOOST_OPERATOR_TEMPLATE(multipliable) BOOST_OPERATOR_TEMPLATE(addable) BOOST_OPERATOR_TEMPLATE(subtractable) BOOST_OPERATOR_TEMPLATE2(subtractable2_left) BOOST_OPERATOR_TEMPLATE(dividable) BOOST_OPERATOR_TEMPLATE2(dividable2_left) BOOST_OPERATOR_TEMPLATE(modable) BOOST_OPERATOR_TEMPLATE2(modable2_left) BOOST_OPERATOR_TEMPLATE(xorable) BOOST_OPERATOR_TEMPLATE(andable) BOOST_OPERATOR_TEMPLATE(orable) BOOST_OPERATOR_TEMPLATE1(incrementable) BOOST_OPERATOR_TEMPLATE1(decrementable) BOOST_OPERATOR_TEMPLATE2(dereferenceable) BOOST_OPERATOR_TEMPLATE3(indexable) BOOST_OPERATOR_TEMPLATE(left_shiftable) BOOST_OPERATOR_TEMPLATE(right_shiftable) BOOST_OPERATOR_TEMPLATE(equivalent) BOOST_OPERATOR_TEMPLATE(partially_ordered) BOOST_OPERATOR_TEMPLATE(totally_ordered) BOOST_OPERATOR_TEMPLATE(additive) BOOST_OPERATOR_TEMPLATE(multiplicative) BOOST_OPERATOR_TEMPLATE(integer_multiplicative) BOOST_OPERATOR_TEMPLATE(arithmetic) BOOST_OPERATOR_TEMPLATE(integer_arithmetic) BOOST_OPERATOR_TEMPLATE(bitwise) BOOST_OPERATOR_TEMPLATE1(unit_steppable) BOOST_OPERATOR_TEMPLATE(shiftable) BOOST_OPERATOR_TEMPLATE(ring_operators) BOOST_OPERATOR_TEMPLATE(ordered_ring_operators) BOOST_OPERATOR_TEMPLATE(field_operators) BOOST_OPERATOR_TEMPLATE(ordered_field_operators) BOOST_OPERATOR_TEMPLATE(euclidian_ring_operators) BOOST_OPERATOR_TEMPLATE(ordered_euclidian_ring_operators) BOOST_OPERATOR_TEMPLATE(euclidean_ring_operators) BOOST_OPERATOR_TEMPLATE(ordered_euclidean_ring_operators) BOOST_OPERATOR_TEMPLATE2(input_iteratable) BOOST_OPERATOR_TEMPLATE1(output_iteratable) BOOST_OPERATOR_TEMPLATE2(forward_iteratable) BOOST_OPERATOR_TEMPLATE2(bidirectional_iteratable) BOOST_OPERATOR_TEMPLATE4(random_access_iteratable) #undef BOOST_OPERATOR_TEMPLATE #undef BOOST_OPERATOR_TEMPLATE4 #undef BOOST_OPERATOR_TEMPLATE3 #undef BOOST_OPERATOR_TEMPLATE2 #undef BOOST_OPERATOR_TEMPLATE1 #undef BOOST_IMPORT_TEMPLATE1 #undef BOOST_IMPORT_TEMPLATE2 #undef BOOST_IMPORT_TEMPLATE3 #undef BOOST_IMPORT_TEMPLATE4 // The following 'operators' classes can only be used portably if the derived class // declares ALL of the required member operators. template <class T, class U> struct operators2 : totally_ordered2<T,U , integer_arithmetic2<T,U , bitwise2<T,U > > > {}; -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template <class T, class U = T> struct operators : operators2<T, U> {}; template <class T> struct operators<T, T> -#else -template <class T> struct operators -#endif : totally_ordered<T , integer_arithmetic<T , bitwise<T , unit_steppable<T > > > > {}; // Iterator helper classes (contributed by Jeremy Siek) -------------------// // (Input and output iterator helpers contributed by Daryle Walker) -------// // (Changed to use combined operator classes by Daryle Walker) ------------// template <class T, class V, class D = std::ptrdiff_t, class P = V const *, class R = V const &> struct input_iterator_helper : input_iteratable<T, P , boost::iterator<std::input_iterator_tag, V, D, P, R > > {}; template<class T> struct output_iterator_helper : output_iteratable<T , boost::iterator<std::output_iterator_tag, void, void, void, void > > { T& operator*() { return static_cast<T&>(*this); } T& operator++() { return static_cast<T&>(*this); } }; template <class T, class V, class D = std::ptrdiff_t, class P = V*, class R = V&> struct forward_iterator_helper |