summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/variant/variant.hpp')
-rw-r--r--3rdParty/Boost/src/boost/variant/variant.hpp60
1 files changed, 43 insertions, 17 deletions
diff --git a/3rdParty/Boost/src/boost/variant/variant.hpp b/3rdParty/Boost/src/boost/variant/variant.hpp
index 205ad8d..d313cd2 100644
--- a/3rdParty/Boost/src/boost/variant/variant.hpp
+++ b/3rdParty/Boost/src/boost/variant/variant.hpp
@@ -40,6 +40,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 +54,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 +72,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 +80,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 +132,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 +249,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 +567,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 +575,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 +614,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 +647,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 +1169,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 +1457,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 +1570,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);
}