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/variant.hpp
parentda7d7a0ca71b80281aa9ff2526290b61ccb0cc60 (diff)
downloadswift-contrib-491ddd570a752cf9bda85933bed0c6942e39b1f9.zip
swift-contrib-491ddd570a752cf9bda85933bed0c6942e39b1f9.tar.bz2
Update Boost to 1.52.0.
Change-Id: I1e56bea2600bf2ed9c5b3aba8c4f9d2a0f350e77
Diffstat (limited to '3rdParty/Boost/src/boost/variant/variant.hpp')
-rw-r--r--3rdParty/Boost/src/boost/variant/variant.hpp61
1 files changed, 44 insertions, 17 deletions
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);
}