summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-12-23 13:16:26 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-12-23 14:43:26 (GMT)
commit491ddd570a752cf9bda85933bed0c6942e39b1f9 (patch)
tree10c25c1be8cc08d0497df1dccd56a10fbb30beee /3rdParty/Boost/src/boost/variant
parentda7d7a0ca71b80281aa9ff2526290b61ccb0cc60 (diff)
downloadswift-491ddd570a752cf9bda85933bed0c6942e39b1f9.zip
swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.tar.bz2
Update Boost to 1.52.0.
Change-Id: I1e56bea2600bf2ed9c5b3aba8c4f9d2a0f350e77
Diffstat (limited to '3rdParty/Boost/src/boost/variant')
-rw-r--r--3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp4
-rw-r--r--3rdParty/Boost/src/boost/variant/detail/hash_variant.hpp48
-rw-r--r--3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp5
-rw-r--r--3rdParty/Boost/src/boost/variant/recursive_variant.hpp63
-rw-r--r--3rdParty/Boost/src/boost/variant/variant.hpp61
-rw-r--r--3rdParty/Boost/src/boost/variant/variant_fwd.hpp2
6 files changed, 135 insertions, 48 deletions
diff --git a/3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp b/3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp
index 2650508..5f5642b 100644
--- a/3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp
+++ b/3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp
@@ -58,7 +58,7 @@ public: // unary visitor interface
template <typename Visitable>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
- operator()(Visitable& visitable)
+ operator()(Visitable& visitable) const
{
return apply_visitor(visitor_, visitable);
}
@@ -67,7 +67,7 @@ public: // binary visitor interface
template <typename Visitable1, typename Visitable2>
BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)
- operator()(Visitable1& visitable1, Visitable2& visitable2)
+ operator()(Visitable1& visitable1, Visitable2& visitable2) const
{
return apply_visitor(visitor_, visitable1, visitable2);
}
diff --git a/3rdParty/Boost/src/boost/variant/detail/hash_variant.hpp b/3rdParty/Boost/src/boost/variant/detail/hash_variant.hpp
new file mode 100644
index 0000000..3da669e
--- /dev/null
+++ b/3rdParty/Boost/src/boost/variant/detail/hash_variant.hpp
@@ -0,0 +1,48 @@
+//-----------------------------------------------------------------------------
+// boost variant/detail/hash_variant.hpp header file
+// See http://www.boost.org for updates, documentation, and revision history.
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 2011
+// Antony Polukhin
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef BOOST_HASH_VARIANT_FUNCTION_HPP
+#define BOOST_HASH_VARIANT_FUNCTION_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <boost/variant/variant_fwd.hpp>
+#include <boost/variant/static_visitor.hpp>
+#include <boost/variant/apply_visitor.hpp>
+#include <boost/functional/hash_fwd.hpp>
+
+namespace boost {
+
+ namespace detail { namespace variant {
+ struct variant_hasher: public boost::static_visitor<std::size_t> {
+ template <class T>
+ std::size_t operator()(T const& val) const {
+ using namespace boost;
+ hash<T> hasher;
+ return hasher(val);
+ }
+ };
+ }}
+
+ template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
+ std::size_t hash_value(variant< BOOST_VARIANT_ENUM_PARAMS(T) > const& val) {
+ std::size_t seed = boost::apply_visitor(detail::variant::variant_hasher(), val);
+ hash_combine(seed, val.which());
+ return seed;
+ }
+}
+
+#endif
+
diff --git a/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp b/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp
index 0d4271a..9cc3015 100644
--- a/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp
+++ b/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp
@@ -167,7 +167,7 @@ visitation_impl_invoke(
, has_nothrow_copy<T>
>::type never_uses_backup;
- return visitation_impl_invoke_impl(
+ return (visitation_impl_invoke_impl)(
internal_which, visitor, storage, t
, never_uses_backup()
);
@@ -246,7 +246,7 @@ visitation_impl(
// ...applying the appropriate case:
# define BOOST_VARIANT_AUX_APPLY_VISITOR_STEP_CASE(z, N, _) \
case (Which::value + (N)): \
- return visitation_impl_invoke( \
+ return (visitation_impl_invoke)( \
internal_which, visitor, storage \
, static_cast<BOOST_PP_CAT(T,N)*>(0) \
, no_backup_flag, 1L \
@@ -261,6 +261,7 @@ visitation_impl(
# undef BOOST_VARIANT_AUX_APPLY_VISITOR_STEP_CASE
+ default: break;
}
// If not handled in this iteration, continue unrolling:
diff --git a/3rdParty/Boost/src/boost/variant/recursive_variant.hpp b/3rdParty/Boost/src/boost/variant/recursive_variant.hpp
index c4cd3b0..071d0f9 100644
--- a/3rdParty/Boost/src/boost/variant/recursive_variant.hpp
+++ b/3rdParty/Boost/src/boost/variant/recursive_variant.hpp
@@ -21,15 +21,15 @@
#include "boost/mpl/aux_/lambda_arity_param.hpp"
-#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
-# include "boost/mpl/eval_if.hpp"
-# include "boost/mpl/identity.hpp"
-# include "boost/mpl/protect.hpp"
-# include "boost/mpl/transform.hpp"
-#else
-# include "boost/preprocessor/cat.hpp"
-# include "boost/preprocessor/repeat.hpp"
-#endif
+#include "boost/mpl/equal.hpp"
+#include "boost/mpl/eval_if.hpp"
+#include "boost/mpl/identity.hpp"
+#include "boost/mpl/if.hpp"
+#include "boost/mpl/protect.hpp"
+#include "boost/mpl/transform.hpp"
+#include "boost/type_traits/is_same.hpp"
+#include "boost/preprocessor/cat.hpp"
+#include "boost/preprocessor/repeat.hpp"
#include "boost/mpl/bool.hpp"
#include "boost/mpl/is_sequence.hpp"
@@ -74,34 +74,48 @@ template <
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(typename Arity)
>
struct substitute<
- ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >
+ ::boost::variant<
+ ::boost::detail::variant::over_sequence< T0 >
+ , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T)
+ >
, RecursiveVariant
, ::boost::recursive_variant_
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(Arity)
>
{
+private:
-#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
-
-private: // helpers, for metafunction result (below)
-
- typedef typename mpl::eval_if<
- ::boost::detail::variant::is_over_sequence<T0>
- , mpl::identity< T0 >
- , make_variant_list< BOOST_VARIANT_ENUM_PARAMS(T) >
- >::type initial_types;
+ typedef T0 initial_types;
typedef typename mpl::transform<
initial_types
, mpl::protect< quoted_enable_recursive<RecursiveVariant,mpl::true_> >
>::type types;
-public: // metafunction result
-
- typedef ::boost::variant< types > type;
+public:
-#else // defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
+ typedef typename mpl::if_<
+ mpl::equal<initial_types, types, ::boost::is_same<mpl::_1, mpl::_2> >
+ , ::boost::variant<
+ ::boost::detail::variant::over_sequence< T0 >
+ , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T)
+ >
+ , ::boost::variant< over_sequence<types> >
+ >::type type;
+};
+template <
+ BOOST_VARIANT_ENUM_PARAMS(typename T)
+ , typename RecursiveVariant
+ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(typename Arity)
+ >
+struct substitute<
+ ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >
+ , RecursiveVariant
+ , ::boost::recursive_variant_
+ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(Arity)
+ >
+{
private: // helpers, for metafunction result (below)
#define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS(z,N,_) \
@@ -123,9 +137,6 @@ private: // helpers, for metafunction result (below)
public: // metafunction result
typedef ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(wknd_T) > type;
-
-#endif // BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT workaround
-
};
#else // defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
diff --git a/3rdParty/Boost/src/boost/variant/variant.hpp b/3rdParty/Boost/src/boost/variant/variant.hpp
index 205ad8d..6afd190 100644
--- a/3rdParty/Boost/src/boost/variant/variant.hpp
+++ b/3rdParty/Boost/src/boost/variant/variant.hpp
@@ -32,6 +32,7 @@
#include "boost/variant/detail/make_variant_list.hpp"
#include "boost/variant/detail/over_sequence.hpp"
#include "boost/variant/detail/visitation_impl.hpp"
+#include "boost/variant/detail/hash_variant.hpp"
#include "boost/variant/detail/generic_result_type.hpp"
#include "boost/variant/detail/has_nothrow_move.hpp"
@@ -40,6 +41,7 @@
#include "boost/detail/reference_content.hpp"
#include "boost/aligned_storage.hpp"
#include "boost/blank.hpp"
+#include "boost/math/common_factor_ct.hpp"
#include "boost/static_assert.hpp"
#include "boost/preprocessor/cat.hpp"
#include "boost/preprocessor/repeat.hpp"
@@ -53,12 +55,14 @@
#include "boost/variant/recursive_wrapper_fwd.hpp"
#include "boost/variant/static_visitor.hpp"
-#include "boost/mpl/eval_if.hpp"
+#include "boost/mpl/assert.hpp"
#include "boost/mpl/begin_end.hpp"
#include "boost/mpl/bool.hpp"
-#include "boost/mpl/not.hpp"
+#include "boost/mpl/deref.hpp"
#include "boost/mpl/empty.hpp"
+#include "boost/mpl/eval_if.hpp"
#include "boost/mpl/find_if.hpp"
+#include "boost/mpl/fold.hpp"
#include "boost/mpl/front.hpp"
#include "boost/mpl/identity.hpp"
#include "boost/mpl/if.hpp"
@@ -69,7 +73,7 @@
#include "boost/mpl/logical.hpp"
#include "boost/mpl/max_element.hpp"
#include "boost/mpl/next.hpp"
-#include "boost/mpl/deref.hpp"
+#include "boost/mpl/not.hpp"
#include "boost/mpl/pair.hpp"
#include "boost/mpl/protect.hpp"
#include "boost/mpl/push_front.hpp"
@@ -77,7 +81,6 @@
#include "boost/mpl/size_t.hpp"
#include "boost/mpl/sizeof.hpp"
#include "boost/mpl/transform.hpp"
-#include "boost/mpl/assert.hpp"
///////////////////////////////////////////////////////////////////////////////
// Implementation Macros:
@@ -130,6 +133,19 @@ public: // metafunction result
};
+struct add_alignment
+{
+ template <typename State, typename Item>
+ struct apply
+ : mpl::size_t<
+ ::boost::math::static_lcm<
+ BOOST_MPL_AUX_VALUE_WKND(State)::value
+ , ::boost::alignment_of<Item>::value
+ >::value
+ >
+ {};
+};
+
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction find_fallback_type
//
@@ -234,8 +250,10 @@ private: // helpers, for metafunction result (below)
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551))
- typedef typename max_value<
- types, alignment_of<mpl::_1>
+ typedef typename mpl::fold<
+ types
+ , mpl::size_t<1>
+ , add_alignment
>::type max_alignment;
#else // borland
@@ -550,7 +568,7 @@ private:
// NOTE: This needs to be a friend of variant, as it needs access to
// indicate_which, indicate_backup_which, etc.
//
-template <typename Variant, typename RhsT>
+template <typename Variant>
class backup_assigner
: public static_visitor<>
{
@@ -558,19 +576,28 @@ private: // representation
Variant& lhs_;
int rhs_which_;
- const RhsT& rhs_content_;
+ const void* rhs_content_;
+ void (*copy_rhs_content_)(void*, const void*);
public: // structors
+ template<class RhsT>
backup_assigner(Variant& lhs, int rhs_which, const RhsT& rhs_content)
: lhs_(lhs)
, rhs_which_(rhs_which)
- , rhs_content_(rhs_content)
+ , rhs_content_(&rhs_content)
+ , copy_rhs_content_(&construct_impl<RhsT>)
{
}
private: // helpers, for visitor interface (below)
+ template<class RhsT>
+ static void construct_impl(void* addr, const void* obj)
+ {
+ new(addr) RhsT(*static_cast<const RhsT*>(obj));
+ }
+
template <typename LhsT>
void backup_assign_impl(
LhsT& lhs_content
@@ -588,7 +615,7 @@ private: // helpers, for visitor interface (below)
try
{
// ...and attempt to copy rhs content into lhs storage:
- new(lhs_.storage_.address()) RhsT(rhs_content_);
+ copy_rhs_content_(lhs_.storage_.address(), rhs_content_);
}
catch (...)
{
@@ -621,7 +648,7 @@ private: // helpers, for visitor interface (below)
try
{
// ...and attempt to copy rhs content into lhs storage:
- new(lhs_.storage_.address()) RhsT(rhs_content_);
+ copy_rhs_content_(lhs_.storage_.address(), rhs_content_);
}
catch (...)
{
@@ -1143,14 +1170,14 @@ private: // helpers, for representation (below)
which_t which_;
storage_t storage_;
- void indicate_which(int which)
+ void indicate_which(int which_arg)
{
- which_ = static_cast<which_t>( which );
+ which_ = static_cast<which_t>( which_arg );
}
- void indicate_backup_which(int which)
+ void indicate_backup_which(int which_arg)
{
- which_ = static_cast<which_t>( -(which + 1) );
+ which_ = static_cast<which_t>( -(which_arg + 1) );
}
private: // helpers, for queries (below)
@@ -1431,7 +1458,7 @@ public: // structors, cont.
private: // helpers, for modifiers (below)
# if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
- template <typename Variant, typename RhsT>
+ template <typename Variant>
friend class detail::variant::backup_assigner;
# endif
@@ -1544,7 +1571,7 @@ private: // helpers, for modifiers (below)
, mpl::false_// has_fallback_type
)
{
- detail::variant::backup_assigner<wknd_self_t, RhsT>
+ detail::variant::backup_assigner<wknd_self_t>
visitor(lhs_, rhs_which_, rhs_content);
lhs_.internal_apply_visitor(visitor);
}
diff --git a/3rdParty/Boost/src/boost/variant/variant_fwd.hpp b/3rdParty/Boost/src/boost/variant/variant_fwd.hpp
index 7482ad4..133f437 100644
--- a/3rdParty/Boost/src/boost/variant/variant_fwd.hpp
+++ b/3rdParty/Boost/src/boost/variant/variant_fwd.hpp
@@ -229,7 +229,7 @@ template < BOOST_VARIANT_AUX_DECLARE_PARAMS > struct make_recursive_variant;
// Tag type indicates where recursive variant substitution should occur.
//
#if !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT)
- struct recursive_variant_;
+ struct recursive_variant_ {};
#else
typedef mpl::arg<1> recursive_variant_;
#endif