diff options
Diffstat (limited to '3rdParty/Boost/src/boost/utility')
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/addressof.hpp | 107 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/base_from_member.hpp | 86 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/declval.hpp | 41 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp | 23 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/enable_if.hpp | 122 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/in_place_factory.hpp | 6 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/result_of.hpp | 41 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/swap.hpp | 58 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/value_init.hpp | 29 |
9 files changed, 212 insertions, 301 deletions
diff --git a/3rdParty/Boost/src/boost/utility/addressof.hpp b/3rdParty/Boost/src/boost/utility/addressof.hpp index 95cd92f..db4da80 100644 --- a/3rdParty/Boost/src/boost/utility/addressof.hpp +++ b/3rdParty/Boost/src/boost/utility/addressof.hpp @@ -1,102 +1,17 @@ -// Copyright (C) 2002 Brad King (brad.king@kitware.com) -// Douglas Gregor (gregod@cs.rpi.edu) -// -// Copyright (C) 2002, 2008 Peter Dimov -// -// 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) - -// For more information, see http://www.boost.org +/* + * Copyright (c) 2014 Glen Fernandes + * + * 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_UTILITY_ADDRESSOF_HPP -# define BOOST_UTILITY_ADDRESSOF_HPP - -# include <boost/config.hpp> -# include <boost/detail/workaround.hpp> - -namespace boost -{ - -namespace detail -{ - -template<class T> struct addr_impl_ref -{ - T & v_; - - inline addr_impl_ref( T & v ): v_( v ) {} - inline operator T& () const { return v_; } - -private: - addr_impl_ref & operator=(const addr_impl_ref &); -}; - -template<class T> struct addressof_impl -{ - static inline T * f( T & v, long ) - { - return reinterpret_cast<T*>( - &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); - } - - static inline T * f( T * v, int ) - { - return v; - } -}; - -} // namespace detail - -template<class T> T * addressof( T & v ) -{ -#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) - - return boost::detail::addressof_impl<T>::f( v, 0 ); +#define BOOST_UTILITY_ADDRESSOF_HPP -#else +// The header file at this path is deprecated; +// use boost/core/addressof.hpp instead. - return boost::detail::addressof_impl<T>::f( boost::detail::addr_impl_ref<T>( v ), 0 ); +#include <boost/core/addressof.hpp> #endif -} - -#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) ) - -namespace detail -{ - -template<class T> struct addressof_addp -{ - typedef T * type; -}; - -} // namespace detail - -template< class T, std::size_t N > -typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] ) -{ - return &t; -} - -#endif - -// Borland doesn't like casting an array reference to a char reference -// but these overloads work around the problem. -#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -template<typename T,std::size_t N> -T (*addressof(T (&t)[N]))[N] -{ - return reinterpret_cast<T(*)[N]>(&t); -} - -template<typename T,std::size_t N> -const T (*addressof(const T (&t)[N]))[N] -{ - return reinterpret_cast<const T(*)[N]>(&t); -} -#endif - -} // namespace boost - -#endif // BOOST_UTILITY_ADDRESSOF_HPP diff --git a/3rdParty/Boost/src/boost/utility/base_from_member.hpp b/3rdParty/Boost/src/boost/utility/base_from_member.hpp index 04aabb5..fc0e13c 100644 --- a/3rdParty/Boost/src/boost/utility/base_from_member.hpp +++ b/3rdParty/Boost/src/boost/utility/base_from_member.hpp @@ -1,6 +1,6 @@ // boost utility/base_from_member.hpp header file --------------------------// -// Copyright 2001, 2003, 2004 Daryle Walker. Use, modification, and +// Copyright 2001, 2003, 2004, 2012 Daryle Walker. Use, modification, and // distribution are subject to the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or a copy at // <http://www.boost.org/LICENSE_1_0.txt>.) @@ -10,10 +10,15 @@ #ifndef BOOST_UTILITY_BASE_FROM_MEMBER_HPP #define BOOST_UTILITY_BASE_FROM_MEMBER_HPP +#include <boost/config.hpp> #include <boost/preprocessor/arithmetic/inc.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/repeat_from_to.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/utility/enable_if.hpp> // Base-from-member arity configuration macro ------------------------------// @@ -53,6 +58,59 @@ namespace boost { +namespace detail +{ + +// Type-unmarking class template -------------------------------------------// + +// Type-trait to get the raw type, i.e. the type without top-level reference nor +// cv-qualification, from a type expression. Mainly for function arguments, any +// reference part is stripped first. + +// Contributed by Daryle Walker + +template < typename T > +struct remove_cv_ref +{ + typedef typename ::boost::remove_cv<typename + ::boost::remove_reference<T>::type>::type type; + +}; // boost::detail::remove_cv_ref + +// Unmarked-type comparison class template ---------------------------------// + +// Type-trait to check if two type expressions have the same raw type. + +// Contributed by Daryle Walker, based on a work-around by Luc Danton + +template < typename T, typename U > +struct is_related + : public ::boost::is_same< + typename ::boost::detail::remove_cv_ref<T>::type, + typename ::boost::detail::remove_cv_ref<U>::type > +{}; + +// Enable-if-on-unidentical-unmarked-type class template -------------------// + +// Enable-if on the first two type expressions NOT having the same raw type. + +// Contributed by Daryle Walker, based on a work-around by Luc Danton + +#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES +template<typename ...T> +struct enable_if_unrelated + : public ::boost::enable_if_c<true> +{}; + +template<typename T, typename U, typename ...U2> +struct enable_if_unrelated<T, U, U2...> + : public ::boost::disable_if< ::boost::detail::is_related<T, U> > +{}; +#endif + +} // namespace boost::detail + + // Base-from-member class template -----------------------------------------// // Helper to initialize a base object so a derived class can use this @@ -68,12 +126,38 @@ class base_from_member protected: MemberType member; +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ + !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \ + !(defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 4)) + template <typename ...T, typename EnableIf = typename + ::boost::detail::enable_if_unrelated<base_from_member, T...>::type> + explicit BOOST_CONSTEXPR base_from_member( T&& ...x ) + BOOST_NOEXCEPT_IF( BOOST_NOEXCEPT_EXPR(::new ((void*) 0) MemberType( + static_cast<T&&>(x)... )) ) // no std::is_nothrow_constructible... + : member( static_cast<T&&>(x)... ) // ...nor std::forward needed + {} +#else base_from_member() : member() {} BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_BASE_FROM_MEMBER_MAX_ARITY), BOOST_PRIVATE_CTR_DEF, _ ) +#endif + +}; // boost::base_from_member + +template < typename MemberType, int UniqueID > +class base_from_member<MemberType&, UniqueID> +{ +protected: + MemberType& member; + + explicit BOOST_CONSTEXPR base_from_member( MemberType& x ) + BOOST_NOEXCEPT + : member( x ) + {} }; // boost::base_from_member diff --git a/3rdParty/Boost/src/boost/utility/declval.hpp b/3rdParty/Boost/src/boost/utility/declval.hpp index d74610c..a4ab2c8 100644 --- a/3rdParty/Boost/src/boost/utility/declval.hpp +++ b/3rdParty/Boost/src/boost/utility/declval.hpp @@ -1,49 +1,44 @@ -// common_type.hpp ---------------------------------------------------------// +// declval.hpp -------------------------------------------------------------// // Copyright 2010 Vicente J. Botet Escriba // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP -#define BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP +#ifndef BOOST_UTILITY_DECLVAL_HPP +#define BOOST_UTILITY_DECLVAL_HPP #include <boost/config.hpp> //----------------------------------------------------------------------------// #include <boost/type_traits/add_rvalue_reference.hpp> -//#include <boost/type_traits/add_lvalue_reference.hpp> //----------------------------------------------------------------------------// // // // C++03 implementation of // +// 20.2.4 Function template declval [declval] // // Written by Vicente J. Botet Escriba // -//~ 20.3.4 Function template declval [declval] -//~ 1 The library provides the function template declval to simplify the definition of expressions which occur as -//~ unevaluated operands. -//~ 2 Remarks: If this function is used, the program is ill-formed. -//~ 3 Remarks: The template parameter T of declval may be an incomplete type. -//~ [ Example: - -//~ template <class To, class From> -//~ decltype(static_cast<To>(declval<From>())) convert(From&&); - -//~ declares a function template convert which only participats in overloading if the type From can be -//~ explicitly converted to type To. For another example see class template common_type (20.7.6.6). —end -//~ example ] // // +// 1 The library provides the function template declval to simplify the +// definition of expressions which occur as unevaluated operands. +// 2 Remarks: If this function is used, the program is ill-formed. +// 3 Remarks: The template parameter T of declval may be an incomplete type. +// [ Example: +// +// template <class To, class From> +// decltype(static_cast<To>(declval<From>())) convert(From&&); +// +// declares a function template convert which only participates in overloading +// if the type From can be explicitly converted to type To. For another example +// see class template common_type (20.9.7.6). -end example ] //----------------------------------------------------------------------------// namespace boost { -//#if !defined(BOOST_NO_RVALUE_REFERENCES) template <typename T> typename add_rvalue_reference<T>::type declval() BOOST_NOEXCEPT; // as unevaluated operand -//#else -// template <typename T> -// typename add_lvalue_reference<T>::type declval() BOOST_NOEXCEPT; // as unevaluated operand -//#endif + } // namespace boost -#endif // BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP +#endif // BOOST_UTILITY_DECLVAL_HPP diff --git a/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp b/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp index 17fd4d5..5192172 100644 --- a/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp +++ b/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp @@ -38,10 +38,25 @@ struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)> #endif #ifdef BOOST_RESULT_OF_USE_DECLTYPE +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct result_of<F(BOOST_RESULT_OF_ARGS)> + : detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> { }; +#endif // BOOST_RESULT_OF_USE_DECLTYPE + +#ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct result_of<F(BOOST_RESULT_OF_ARGS)> + : mpl::if_<mpl::or_<detail::has_result_type<F>, detail::has_result<F> >, + tr1_result_of<F(BOOST_RESULT_OF_ARGS)>, + detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> >::type { }; +#endif // BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK + +#if defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) + +namespace detail { -// Uses declval following N3225 20.7.7.6 when F is not a pointer. template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> -struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))> +struct cpp0x_result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))> : mpl::if_< is_member_function_pointer<F> , detail::tr1_result_of_impl< @@ -54,8 +69,6 @@ struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))> >::type {}; -namespace detail { - #ifdef BOOST_NO_SFINAE_EXPR template<typename F> @@ -139,7 +152,7 @@ struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), } // namespace detail -#else // defined(BOOST_RESULT_OF_USE_DECLTYPE) +#else // defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> diff --git a/3rdParty/Boost/src/boost/utility/enable_if.hpp b/3rdParty/Boost/src/boost/utility/enable_if.hpp index d292c6a..803bfca 100644 --- a/3rdParty/Boost/src/boost/utility/enable_if.hpp +++ b/3rdParty/Boost/src/boost/utility/enable_if.hpp @@ -1,119 +1,17 @@ -// Boost enable_if library - -// Copyright 2003 (c) The Trustees of Indiana University. - -// Use, modification, and distribution is subject to 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) - -// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - +/* + * Copyright (c) 2014 Glen Fernandes + * + * 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_UTILITY_ENABLE_IF_HPP #define BOOST_UTILITY_ENABLE_IF_HPP -#include "boost/config.hpp" - -// Even the definition of enable_if causes problems on some compilers, -// so it's macroed out for all compilers that do not support SFINAE - -#ifndef BOOST_NO_SFINAE - -namespace boost -{ - - template <bool B, class T = void> - struct enable_if_c { - typedef T type; - }; - - template <class T> - struct enable_if_c<false, T> {}; - - template <class Cond, class T = void> - struct enable_if : public enable_if_c<Cond::value, T> {}; - - template <bool B, class T> - struct lazy_enable_if_c { - typedef typename T::type type; - }; - - template <class T> - struct lazy_enable_if_c<false, T> {}; - - template <class Cond, class T> - struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {}; - - - template <bool B, class T = void> - struct disable_if_c { - typedef T type; - }; - - template <class T> - struct disable_if_c<true, T> {}; - - template <class Cond, class T = void> - struct disable_if : public disable_if_c<Cond::value, T> {}; - - template <bool B, class T> - struct lazy_disable_if_c { - typedef typename T::type type; - }; - - template <class T> - struct lazy_disable_if_c<true, T> {}; - - template <class Cond, class T> - struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {}; - -} // namespace boost - -#else - -namespace boost { - - namespace detail { typedef void enable_if_default_T; } - - template <typename T> - struct enable_if_does_not_work_on_this_compiler; - - template <bool B, class T = detail::enable_if_default_T> - struct enable_if_c : enable_if_does_not_work_on_this_compiler<T> - { }; - - template <bool B, class T = detail::enable_if_default_T> - struct disable_if_c : enable_if_does_not_work_on_this_compiler<T> - { }; - - template <bool B, class T = detail::enable_if_default_T> - struct lazy_enable_if_c : enable_if_does_not_work_on_this_compiler<T> - { }; - - template <bool B, class T = detail::enable_if_default_T> - struct lazy_disable_if_c : enable_if_does_not_work_on_this_compiler<T> - { }; - - template <class Cond, class T = detail::enable_if_default_T> - struct enable_if : enable_if_does_not_work_on_this_compiler<T> - { }; - - template <class Cond, class T = detail::enable_if_default_T> - struct disable_if : enable_if_does_not_work_on_this_compiler<T> - { }; - - template <class Cond, class T = detail::enable_if_default_T> - struct lazy_enable_if : enable_if_does_not_work_on_this_compiler<T> - { }; - - template <class Cond, class T = detail::enable_if_default_T> - struct lazy_disable_if : enable_if_does_not_work_on_this_compiler<T> - { }; - -} // namespace boost +// The header file at this path is deprecated; +// use boost/core/enable_if.hpp instead. -#endif // BOOST_NO_SFINAE +#include <boost/core/enable_if.hpp> #endif diff --git a/3rdParty/Boost/src/boost/utility/in_place_factory.hpp b/3rdParty/Boost/src/boost/utility/in_place_factory.hpp index f84b003..1a62ace 100644 --- a/3rdParty/Boost/src/boost/utility/in_place_factory.hpp +++ b/3rdParty/Boost/src/boost/utility/in_place_factory.hpp @@ -48,15 +48,13 @@ public: {} template<class T> - void* apply(void* address - BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) const + void* apply(void* address) const { return new(address) T( BOOST_PP_ENUM_PARAMS(N, m_a) ); } template<class T> - void* apply(void* address, std::size_t n - BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) const + void* apply(void* address, std::size_t n) const { for(char* next = address = this->BOOST_NESTED_TEMPLATE apply<T>(address); !! --n;) diff --git a/3rdParty/Boost/src/boost/utility/result_of.hpp b/3rdParty/Boost/src/boost/utility/result_of.hpp index f0e084a..206ae30 100644 --- a/3rdParty/Boost/src/boost/utility/result_of.hpp +++ b/3rdParty/Boost/src/boost/utility/result_of.hpp @@ -38,18 +38,27 @@ // Use the decltype-based version of result_of by default if the compiler // supports N3276 <http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2011/n3276.pdf>. -// The user can force the choice by defining either BOOST_RESULT_OF_USE_DECLTYPE or -// BOOST_RESULT_OF_USE_TR1, but not both! -#if defined(BOOST_RESULT_OF_USE_DECLTYPE) && defined(BOOST_RESULT_OF_USE_TR1) -# error Both BOOST_RESULT_OF_USE_DECLTYPE and BOOST_RESULT_OF_USE_TR1 cannot be defined at the same time. +// The user can force the choice by defining BOOST_RESULT_OF_USE_DECLTYPE, +// BOOST_RESULT_OF_USE_TR1, or BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK but not more than one! +#if (defined(BOOST_RESULT_OF_USE_DECLTYPE) && defined(BOOST_RESULT_OF_USE_TR1)) || \ + (defined(BOOST_RESULT_OF_USE_DECLTYPE) && defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)) || \ + (defined(BOOST_RESULT_OF_USE_TR1) && defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)) +# error More than one of BOOST_RESULT_OF_USE_DECLTYPE, BOOST_RESULT_OF_USE_TR1 and \ + BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK cannot be defined at the same time. +#endif + +#if defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) && defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE) +# error Cannot fallback to decltype if BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE is not defined. #endif #ifndef BOOST_RESULT_OF_USE_TR1 # ifndef BOOST_RESULT_OF_USE_DECLTYPE -# ifndef BOOST_NO_DECLTYPE_N3276 // this implies !defined(BOOST_NO_DECLTYPE) -# define BOOST_RESULT_OF_USE_DECLTYPE -# else -# define BOOST_RESULT_OF_USE_TR1 +# ifndef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK +# ifndef BOOST_NO_CXX11_DECLTYPE_N3276 // this implies !defined(BOOST_NO_CXX11_DECLTYPE) +# define BOOST_RESULT_OF_USE_DECLTYPE +# else +# define BOOST_RESULT_OF_USE_TR1 +# endif # endif # endif #endif @@ -59,15 +68,29 @@ namespace boost { template<typename F> struct result_of; template<typename F> struct tr1_result_of; // a TR1-style implementation of result_of -#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if !defined(BOOST_NO_SFINAE) namespace detail { BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) +// Work around a nvcc bug by only defining has_result when it's needed. +#ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK +BOOST_MPL_HAS_XXX_TEMPLATE_DEF(result) +#endif + template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl; +template<typename F> struct cpp0x_result_of; + #ifdef BOOST_NO_SFINAE_EXPR +// There doesn't seem to be any other way to turn this off such that the presence of +// the user-defined operator,() below doesn't cause spurious warning all over the place, +// so unconditionally turn it off. +#if BOOST_MSVC +# pragma warning(disable: 4913) // user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used +#endif + struct result_of_private_type {}; struct result_of_weird_type { diff --git a/3rdParty/Boost/src/boost/utility/swap.hpp b/3rdParty/Boost/src/boost/utility/swap.hpp index 6845e79..dd9ecd9 100644 --- a/3rdParty/Boost/src/boost/utility/swap.hpp +++ b/3rdParty/Boost/src/boost/utility/swap.hpp @@ -1,55 +1,17 @@ -// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker -// -// 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) -// For more information, see http://www.boost.org - +/* + * Copyright (c) 2014 Glen Fernandes + * + * 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_UTILITY_SWAP_HPP #define BOOST_UTILITY_SWAP_HPP -// Note: the implementation of this utility contains various workarounds: -// - swap_impl is put outside the boost namespace, to avoid infinite -// recursion (causing stack overflow) when swapping objects of a primitive -// type. -// - swap_impl has a using-directive, rather than a using-declaration, -// because some compilers (including MSVC 7.1, Borland 5.9.3, and -// Intel 8.1) don't do argument-dependent lookup when it has a -// using-declaration instead. -// - boost::swap has two template arguments, instead of one, to -// avoid ambiguity when swapping objects of a Boost type that does -// not have its own boost::swap overload. - -#include <algorithm> //for std::swap -#include <cstddef> //for std::size_t - -namespace boost_swap_impl -{ - template<class T> - void swap_impl(T& left, T& right) - { - using namespace std;//use std::swap if argument dependent lookup fails - swap(left,right); - } - - template<class T, std::size_t N> - void swap_impl(T (& left)[N], T (& right)[N]) - { - for (std::size_t i = 0; i < N; ++i) - { - ::boost_swap_impl::swap_impl(left[i], right[i]); - } - } -} +// The header file at this path is deprecated; +// use boost/core/swap.hpp instead. -namespace boost -{ - template<class T1, class T2> - void swap(T1& left, T2& right) - { - ::boost_swap_impl::swap_impl(left, right); - } -} +#include <boost/core/swap.hpp> #endif diff --git a/3rdParty/Boost/src/boost/utility/value_init.hpp b/3rdParty/Boost/src/boost/utility/value_init.hpp index 5de9585..9d8de70 100644 --- a/3rdParty/Boost/src/boost/utility/value_init.hpp +++ b/3rdParty/Boost/src/boost/utility/value_init.hpp @@ -33,7 +33,6 @@ #ifdef BOOST_MSVC #pragma warning(push) -#if _MSC_VER >= 1310 // It is safe to ignore the following warning from MSVC 7.1 or higher: // "warning C4351: new behavior: elements of array will be default initialized" #pragma warning(disable: 4351) @@ -41,7 +40,6 @@ // a const type: "warning C4512: assignment operator could not be generated". #pragma warning(disable: 4512) #endif -#endif #ifdef BOOST_NO_COMPLETE_VALUE_INITIALIZATION // Implementation detail: The macro BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED @@ -73,12 +71,14 @@ class initialized #endif remove_const<T>::type data; + BOOST_GPU_ENABLED wrapper() : data() { } + BOOST_GPU_ENABLED wrapper(T const & arg) : data(arg) @@ -92,6 +92,7 @@ class initialized #endif aligned_storage<sizeof(wrapper), alignment_of<wrapper>::value>::type x; + BOOST_GPU_ENABLED wrapper * wrapper_address() const { return static_cast<wrapper *>( static_cast<void*>(&x)); @@ -99,6 +100,7 @@ class initialized public : + BOOST_GPU_ENABLED initialized() { #if BOOST_DETAIL_VALUE_INIT_WORKAROUND @@ -107,16 +109,19 @@ class initialized new (wrapper_address()) wrapper(); } + BOOST_GPU_ENABLED initialized(initialized const & arg) { new (wrapper_address()) wrapper( static_cast<wrapper const &>(*(arg.wrapper_address()))); } + BOOST_GPU_ENABLED explicit initialized(T const & arg) { new (wrapper_address()) wrapper(arg); } + BOOST_GPU_ENABLED initialized & operator=(initialized const & arg) { // Assignment is only allowed when T is non-const. @@ -125,31 +130,37 @@ class initialized return *this; } + BOOST_GPU_ENABLED ~initialized() { wrapper_address()->wrapper::~wrapper(); } + BOOST_GPU_ENABLED T const & data() const { return wrapper_address()->data; } + BOOST_GPU_ENABLED T& data() { return wrapper_address()->data; } + BOOST_GPU_ENABLED void swap(initialized & arg) { ::boost::swap( this->data(), arg.data() ); } + BOOST_GPU_ENABLED operator T const &() const { return wrapper_address()->data; } + BOOST_GPU_ENABLED operator T&() { return wrapper_address()->data; @@ -158,18 +169,21 @@ class initialized } ; template<class T> +BOOST_GPU_ENABLED T const& get ( initialized<T> const& x ) { return x.data() ; } template<class T> +BOOST_GPU_ENABLED T& get ( initialized<T>& x ) { return x.data() ; } template<class T> +BOOST_GPU_ENABLED void swap ( initialized<T> & lhs, initialized<T> & rhs ) { lhs.swap(rhs) ; @@ -185,31 +199,37 @@ class value_initialized public : + BOOST_GPU_ENABLED value_initialized() : m_data() { } + BOOST_GPU_ENABLED T const & data() const { return m_data.data(); } + BOOST_GPU_ENABLED T& data() { return m_data.data(); } + BOOST_GPU_ENABLED void swap(value_initialized & arg) { m_data.swap(arg.m_data); } + BOOST_GPU_ENABLED operator T const &() const { return m_data; } + BOOST_GPU_ENABLED operator T&() { return m_data; @@ -218,18 +238,21 @@ class value_initialized template<class T> +BOOST_GPU_ENABLED T const& get ( value_initialized<T> const& x ) { return x.data() ; } template<class T> +BOOST_GPU_ENABLED T& get ( value_initialized<T>& x ) { return x.data() ; } template<class T> +BOOST_GPU_ENABLED void swap ( value_initialized<T> & lhs, value_initialized<T> & rhs ) { lhs.swap(rhs) ; @@ -240,7 +263,7 @@ class initialized_value_t { public : - template <class T> operator T() const + template <class T> BOOST_GPU_ENABLED operator T() const { return initialized<T>().data(); } |