diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-08-02 20:41:55 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-08-02 21:03:09 (GMT) |
commit | d5ace22054203c7989691ae8b3fa4e4784d1b57e (patch) | |
tree | 64d400cdb10644967df183d0f202fcbf8160a773 /3rdParty/Boost/src/boost/variant | |
parent | 6f26d9aa86f0909af13b23b1a925b8d492e74154 (diff) | |
download | swift-contrib-ks/boost1.47.zip swift-contrib-ks/boost1.47.tar.bz2 |
Add two extra Boost dependencies, upgrade to 1.47.0ks/boost1.47
Diffstat (limited to '3rdParty/Boost/src/boost/variant')
5 files changed, 86 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/visitation_impl.hpp b/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp index 0d4271a..73b33dd 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: BOOST_ASSERT(!"Boost.Variant internal error: 'which' out of range."); } // 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..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); } 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 |