summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/tuple')
-rw-r--r--3rdParty/Boost/src/boost/tuple/detail/tuple_basic.hpp321
-rw-r--r--3rdParty/Boost/src/boost/tuple/detail/tuple_basic_no_partial_spec.hpp24
2 files changed, 198 insertions, 147 deletions
diff --git a/3rdParty/Boost/src/boost/tuple/detail/tuple_basic.hpp b/3rdParty/Boost/src/boost/tuple/detail/tuple_basic.hpp
index 348fd80..88f0d90 100644
--- a/3rdParty/Boost/src/boost/tuple/detail/tuple_basic.hpp
+++ b/3rdParty/Boost/src/boost/tuple/detail/tuple_basic.hpp
@@ -37,6 +37,7 @@
#include "boost/type_traits/cv_traits.hpp"
#include "boost/type_traits/function_traits.hpp"
+#include "boost/utility/swap.hpp"
#include "boost/detail/workaround.hpp" // needed for BOOST_WORKAROUND
@@ -86,45 +87,28 @@ namespace detail {
template<class T>
class generate_error;
-// - cons getters --------------------------------------------------------
-// called: get_class<N>::get<RETURN_TYPE>(aTuple)
-
-template< int N >
-struct get_class {
- template<class RET, class HT, class TT >
- inline static RET get(const cons<HT, TT>& t)
- {
-#if BOOST_WORKAROUND(__IBMCPP__,==600)
- // vacpp 6.0 is not very consistent regarding the member template keyword
- // Here it generates an error when the template keyword is used.
- return get_class<N-1>::get<RET>(t.tail);
-#else
- return get_class<N-1>::BOOST_NESTED_TEMPLATE get<RET>(t.tail);
-#endif
- }
- template<class RET, class HT, class TT >
- inline static RET get(cons<HT, TT>& t)
- {
-#if BOOST_WORKAROUND(__IBMCPP__,==600)
- return get_class<N-1>::get<RET>(t.tail);
-#else
- return get_class<N-1>::BOOST_NESTED_TEMPLATE get<RET>(t.tail);
-#endif
- }
+template<int N>
+struct drop_front {
+ template<class Tuple>
+ struct apply {
+ typedef BOOST_DEDUCED_TYPENAME drop_front<N-1>::BOOST_NESTED_TEMPLATE
+ apply<Tuple> next;
+ typedef BOOST_DEDUCED_TYPENAME next::type::tail_type type;
+ static const type& call(const Tuple& tup) {
+ return next::call(tup).tail;
+ }
+ };
};
template<>
-struct get_class<0> {
- template<class RET, class HT, class TT>
- inline static RET get(const cons<HT, TT>& t)
- {
- return t.head;
- }
- template<class RET, class HT, class TT>
- inline static RET get(cons<HT, TT>& t)
- {
- return t.head;
- }
+struct drop_front<0> {
+ template<class Tuple>
+ struct apply {
+ typedef Tuple type;
+ static const type& call(const Tuple& tup) {
+ return tup;
+ }
+ };
};
} // end of namespace detail
@@ -140,41 +124,23 @@ struct get_class<0> {
template<int N, class T>
struct element
{
-private:
- typedef typename T::tail_type Next;
-public:
- typedef typename element<N-1, Next>::type type;
-};
-template<class T>
-struct element<0,T>
-{
- typedef typename T::head_type type;
+ typedef BOOST_DEDUCED_TYPENAME detail::drop_front<N>::BOOST_NESTED_TEMPLATE
+ apply<T>::type::head_type type;
};
template<int N, class T>
struct element<N, const T>
{
private:
- typedef typename T::tail_type Next;
- typedef typename element<N-1, Next>::type unqualified_type;
+ typedef BOOST_DEDUCED_TYPENAME detail::drop_front<N>::BOOST_NESTED_TEMPLATE
+ apply<T>::type::head_type unqualified_type;
public:
#if BOOST_WORKAROUND(__BORLANDC__,<0x600)
typedef const unqualified_type type;
#else
- typedef typename boost::add_const<unqualified_type>::type type;
-#endif
-
-};
-template<class T>
-struct element<0,const T>
-{
-#if BOOST_WORKAROUND(__BORLANDC__,<0x600)
- typedef const typename T::head_type type;
-#else
- typedef typename boost::add_const<typename T::head_type>::type type;
+ typedef BOOST_DEDUCED_TYPENAME boost::add_const<unqualified_type>::type type;
#endif
};
-
#else // def BOOST_NO_CV_SPECIALIZATIONS
namespace detail {
@@ -182,31 +148,16 @@ namespace detail {
template<int N, class T, bool IsConst>
struct element_impl
{
-private:
- typedef typename T::tail_type Next;
-public:
- typedef typename element_impl<N-1, Next, IsConst>::type type;
+ typedef BOOST_DEDUCED_TYPENAME detail::drop_front<N>::BOOST_NESTED_TEMPLATE
+ apply<T>::type::head_type type;
};
template<int N, class T>
struct element_impl<N, T, true /* IsConst */>
{
-private:
- typedef typename T::tail_type Next;
-public:
- typedef const typename element_impl<N-1, Next, true>::type type;
-};
-
-template<class T>
-struct element_impl<0, T, false /* IsConst */>
-{
- typedef typename T::head_type type;
-};
-
-template<class T>
-struct element_impl<0, T, true /* IsConst */>
-{
- typedef const typename T::head_type type;
+ typedef BOOST_DEDUCED_TYPENAME detail::drop_front<N>::BOOST_NESTED_TEMPLATE
+ apply<T>::type::head_type unqualified_type;
+ typedef const unqualified_type type;
};
} // end of namespace detail
@@ -258,17 +209,10 @@ inline typename access_traits<
typename element<N, cons<HT, TT> >::type
>::non_const_type
get(cons<HT, TT>& c BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int, N)) {
-#if BOOST_WORKAROUND(__IBMCPP__,==600 )
- return detail::get_class<N>::
-#else
- return detail::get_class<N>::BOOST_NESTED_TEMPLATE
-#endif
- get<
- typename access_traits<
- typename element<N, cons<HT, TT> >::type
- >::non_const_type,
- HT,TT
- >(c);
+ typedef BOOST_DEDUCED_TYPENAME detail::drop_front<N>::BOOST_NESTED_TEMPLATE
+ apply<cons<HT, TT> > impl;
+ typedef BOOST_DEDUCED_TYPENAME impl::type cons_element;
+ return const_cast<cons_element&>(impl::call(c)).head;
}
// get function for const cons-lists, returns a const reference to
@@ -279,17 +223,10 @@ inline typename access_traits<
typename element<N, cons<HT, TT> >::type
>::const_type
get(const cons<HT, TT>& c BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int, N)) {
-#if BOOST_WORKAROUND(__IBMCPP__,==600)
- return detail::get_class<N>::
-#else
- return detail::get_class<N>::BOOST_NESTED_TEMPLATE
-#endif
- get<
- typename access_traits<
- typename element<N, cons<HT, TT> >::type
- >::const_type,
- HT,TT
- >(c);
+ typedef BOOST_DEDUCED_TYPENAME detail::drop_front<N>::BOOST_NESTED_TEMPLATE
+ apply<cons<HT, TT> > impl;
+ typedef BOOST_DEDUCED_TYPENAME impl::type cons_element;
+ return impl::call(c).head;
}
// -- the cons template --------------------------------------------------
@@ -663,18 +600,21 @@ public:
// Swallows any assignment (by Doug Gregor)
namespace detail {
+struct swallow_assign;
+typedef void (detail::swallow_assign::*ignore_t)();
struct swallow_assign {
-
+ swallow_assign(ignore_t(*)(ignore_t)) {}
template<typename T>
swallow_assign const& operator=(const T&) const {
return *this;
}
};
+
} // namespace detail
// "ignore" allows tuple positions to be ignored when using "tie".
-detail::swallow_assign const ignore = detail::swallow_assign();
+inline detail::ignore_t ignore(detail::ignore_t) { return 0; }
// ---------------------------------------------------------------------------
// The call_traits for make_tuple
@@ -756,6 +696,10 @@ struct make_tuple_traits<const reference_wrapper<T> >{
typedef T& type;
};
+template<>
+struct make_tuple_traits<detail::ignore_t(detail::ignore_t)> {
+ typedef detail::swallow_assign type;
+};
@@ -877,71 +821,154 @@ make_tuple(const T0& t0, const T1& t1, const T2& t2, const T3& t3,
return t(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9);
}
+namespace detail {
+template<class T>
+struct tie_traits {
+ typedef T& type;
+};
+
+template<>
+struct tie_traits<ignore_t(ignore_t)> {
+ typedef swallow_assign type;
+};
+
+template<>
+struct tie_traits<void> {
+ typedef null_type type;
+};
+
+template <
+ class T0 = void, class T1 = void, class T2 = void,
+ class T3 = void, class T4 = void, class T5 = void,
+ class T6 = void, class T7 = void, class T8 = void,
+ class T9 = void
+>
+struct tie_mapper {
+ typedef
+ tuple<typename tie_traits<T0>::type,
+ typename tie_traits<T1>::type,
+ typename tie_traits<T2>::type,
+ typename tie_traits<T3>::type,
+ typename tie_traits<T4>::type,
+ typename tie_traits<T5>::type,
+ typename tie_traits<T6>::type,
+ typename tie_traits<T7>::type,
+ typename tie_traits<T8>::type,
+ typename tie_traits<T9>::type> type;
+};
+
+}
// Tie function templates -------------------------------------------------
-template<class T1>
-inline tuple<T1&> tie(T1& t1) {
- return tuple<T1&> (t1);
+template<class T0>
+inline typename detail::tie_mapper<T0>::type
+tie(T0& t0) {
+ typedef typename detail::tie_mapper<T0>::type t;
+ return t(t0);
}
-template<class T1, class T2>
-inline tuple<T1&, T2&> tie(T1& t1, T2& t2) {
- return tuple<T1&, T2&> (t1, t2);
+template<class T0, class T1>
+inline typename detail::tie_mapper<T0, T1>::type
+tie(T0& t0, T1& t1) {
+ typedef typename detail::tie_mapper<T0, T1>::type t;
+ return t(t0, t1);
}
-template<class T1, class T2, class T3>
-inline tuple<T1&, T2&, T3&> tie(T1& t1, T2& t2, T3& t3) {
- return tuple<T1&, T2&, T3&> (t1, t2, t3);
+template<class T0, class T1, class T2>
+inline typename detail::tie_mapper<T0, T1, T2>::type
+tie(T0& t0, T1& t1, T2& t2) {
+ typedef typename detail::tie_mapper<T0, T1, T2>::type t;
+ return t(t0, t1, t2);
}
-template<class T1, class T2, class T3, class T4>
-inline tuple<T1&, T2&, T3&, T4&> tie(T1& t1, T2& t2, T3& t3, T4& t4) {
- return tuple<T1&, T2&, T3&, T4&> (t1, t2, t3, t4);
+template<class T0, class T1, class T2, class T3>
+inline typename detail::tie_mapper<T0, T1, T2, T3>::type
+tie(T0& t0, T1& t1, T2& t2, T3& t3) {
+ typedef typename detail::tie_mapper<T0, T1, T2, T3>::type t;
+ return t(t0, t1, t2, t3);
}
-template<class T1, class T2, class T3, class T4, class T5>
-inline tuple<T1&, T2&, T3&, T4&, T5&>
-tie(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5) {
- return tuple<T1&, T2&, T3&, T4&, T5&> (t1, t2, t3, t4, t5);
+template<class T0, class T1, class T2, class T3, class T4>
+inline typename detail::tie_mapper<T0, T1, T2, T3, T4>::type
+tie(T0& t0, T1& t1, T2& t2, T3& t3,
+ T4& t4) {
+ typedef typename detail::tie_mapper<T0, T1, T2, T3, T4>::type t;
+ return t(t0, t1, t2, t3, t4);
}
-template<class T1, class T2, class T3, class T4, class T5, class T6>
-inline tuple<T1&, T2&, T3&, T4&, T5&, T6&>
-tie(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6) {
- return tuple<T1&, T2&, T3&, T4&, T5&, T6&> (t1, t2, t3, t4, t5, t6);
+template<class T0, class T1, class T2, class T3, class T4, class T5>
+inline typename detail::tie_mapper<T0, T1, T2, T3, T4, T5>::type
+tie(T0& t0, T1& t1, T2& t2, T3& t3,
+ T4& t4, T5& t5) {
+ typedef typename detail::tie_mapper<T0, T1, T2, T3, T4, T5>::type t;
+ return t(t0, t1, t2, t3, t4, t5);
}
-template<class T1, class T2, class T3, class T4, class T5, class T6, class T7>
-inline tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&>
-tie(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7) {
- return tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&> (t1, t2, t3, t4, t5, t6, t7);
+template<class T0, class T1, class T2, class T3, class T4, class T5, class T6>
+inline typename detail::tie_mapper<T0, T1, T2, T3, T4, T5, T6>::type
+tie(T0& t0, T1& t1, T2& t2, T3& t3,
+ T4& t4, T5& t5, T6& t6) {
+ typedef typename detail::tie_mapper
+ <T0, T1, T2, T3, T4, T5, T6>::type t;
+ return t(t0, t1, t2, t3, t4, t5, t6);
+}
+
+template<class T0, class T1, class T2, class T3, class T4, class T5, class T6,
+ class T7>
+inline typename detail::tie_mapper<T0, T1, T2, T3, T4, T5, T6, T7>::type
+tie(T0& t0, T1& t1, T2& t2, T3& t3,
+ T4& t4, T5& t5, T6& t6, T7& t7) {
+ typedef typename detail::tie_mapper
+ <T0, T1, T2, T3, T4, T5, T6, T7>::type t;
+ return t(t0, t1, t2, t3, t4, t5, t6, t7);
}
-template<class T1, class T2, class T3, class T4, class T5, class T6, class T7,
- class T8>
-inline tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&>
-tie(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8) {
- return tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&>
- (t1, t2, t3, t4, t5, t6, t7, t8);
+template<class T0, class T1, class T2, class T3, class T4, class T5, class T6,
+ class T7, class T8>
+inline typename detail::tie_mapper
+ <T0, T1, T2, T3, T4, T5, T6, T7, T8>::type
+tie(T0& t0, T1& t1, T2& t2, T3& t3,
+ T4& t4, T5& t5, T6& t6, T7& t7,
+ T8& t8) {
+ typedef typename detail::tie_mapper
+ <T0, T1, T2, T3, T4, T5, T6, T7, T8>::type t;
+ return t(t0, t1, t2, t3, t4, t5, t6, t7, t8);
}
-template<class T1, class T2, class T3, class T4, class T5, class T6, class T7,
- class T8, class T9>
-inline tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&>
-tie(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8,
- T9& t9) {
- return tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&>
- (t1, t2, t3, t4, t5, t6, t7, t8, t9);
+template<class T0, class T1, class T2, class T3, class T4, class T5, class T6,
+ class T7, class T8, class T9>
+inline typename detail::tie_mapper
+ <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::type
+tie(T0& t0, T1& t1, T2& t2, T3& t3,
+ T4& t4, T5& t5, T6& t6, T7& t7,
+ T8& t8, T9& t9) {
+ typedef typename detail::tie_mapper
+ <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::type t;
+ return t(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9);
}
-template<class T1, class T2, class T3, class T4, class T5, class T6, class T7,
- class T8, class T9, class T10>
-inline tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&>
-tie(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8,
- T9& t9, T10& t10) {
- return tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&>
- (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
+template <class T0, class T1, class T2, class T3, class T4,
+ class T5, class T6, class T7, class T8, class T9>
+void swap(tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>& lhs,
+ tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>& rhs);
+inline void swap(null_type&, null_type&) {}
+template<class HH>
+inline void swap(cons<HH, null_type>& lhs, cons<HH, null_type>& rhs) {
+ ::boost::swap(lhs.head, rhs.head);
+}
+template<class HH, class TT>
+inline void swap(cons<HH, TT>& lhs, cons<HH, TT>& rhs) {
+ ::boost::swap(lhs.head, rhs.head);
+ ::boost::tuples::swap(lhs.tail, rhs.tail);
+}
+template <class T0, class T1, class T2, class T3, class T4,
+ class T5, class T6, class T7, class T8, class T9>
+inline void swap(tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>& lhs,
+ tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>& rhs) {
+ typedef tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> tuple_type;
+ typedef typename tuple_type::inherited base;
+ ::boost::tuples::swap(static_cast<base&>(lhs), static_cast<base&>(rhs));
}
} // end of namespace tuples
diff --git a/3rdParty/Boost/src/boost/tuple/detail/tuple_basic_no_partial_spec.hpp b/3rdParty/Boost/src/boost/tuple/detail/tuple_basic_no_partial_spec.hpp
index bb38662..7379bf8 100644
--- a/3rdParty/Boost/src/boost/tuple/detail/tuple_basic_no_partial_spec.hpp
+++ b/3rdParty/Boost/src/boost/tuple/detail/tuple_basic_no_partial_spec.hpp
@@ -27,6 +27,7 @@
#define BOOST_TUPLE_BASIC_NO_PARTIAL_SPEC_HPP
#include "boost/type_traits.hpp"
+#include "boost/utility/swap.hpp"
#include <utility>
#if defined BOOST_MSVC
@@ -836,6 +837,29 @@ namespace tuples {
detail::swallow_assign const ignore = detail::swallow_assign();
+template <class T0, class T1, class T2, class T3, class T4,
+ class T5, class T6, class T7, class T8, class T9>
+void swap(tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>& lhs,
+ tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>& rhs);
+inline void swap(null_type&, null_type&) {}
+template<class HH>
+inline void swap(cons<HH, null_type>& lhs, cons<HH, null_type>& rhs) {
+ ::boost::swap(lhs.head, rhs.head);
+}
+template<class HH, class TT>
+inline void swap(cons<HH, TT>& lhs, cons<HH, TT>& rhs) {
+ ::boost::swap(lhs.head, rhs.head);
+ ::boost::tuples::swap(lhs.tail, rhs.tail);
+}
+template <class T0, class T1, class T2, class T3, class T4,
+ class T5, class T6, class T7, class T8, class T9>
+inline void swap(tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>& lhs,
+ tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>& rhs) {
+ typedef tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> tuple_type;
+ typedef typename tuple_type::inherited base;
+ ::boost::tuples::swap(static_cast<base&>(lhs), static_cast<base&>(rhs));
+}
+
} // namespace tuples
} // namespace boost
#endif // BOOST_TUPLE_BASIC_NO_PARTIAL_SPEC_HPP