summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/utility')
-rw-r--r--3rdParty/Boost/src/boost/utility/declval.hpp9
-rw-r--r--3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp208
-rw-r--r--3rdParty/Boost/src/boost/utility/identity_type.hpp46
-rw-r--r--3rdParty/Boost/src/boost/utility/result_of.hpp187
-rw-r--r--3rdParty/Boost/src/boost/utility/value_init.hpp258
5 files changed, 706 insertions, 2 deletions
diff --git a/3rdParty/Boost/src/boost/utility/declval.hpp b/3rdParty/Boost/src/boost/utility/declval.hpp
index 41ec3dc..d74610c 100644
--- a/3rdParty/Boost/src/boost/utility/declval.hpp
+++ b/3rdParty/Boost/src/boost/utility/declval.hpp
@@ -13,6 +13,7 @@
//----------------------------------------------------------------------------//
#include <boost/type_traits/add_rvalue_reference.hpp>
+//#include <boost/type_traits/add_lvalue_reference.hpp>
//----------------------------------------------------------------------------//
// //
@@ -36,9 +37,13 @@
namespace boost {
+//#if !defined(BOOST_NO_RVALUE_REFERENCES)
template <typename T>
- typename add_rvalue_reference<T>::type declval(); //noexcept; // as unevaluated operand
-
+ 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
diff --git a/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp b/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp
new file mode 100644
index 0000000..17fd4d5
--- /dev/null
+++ b/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp
@@ -0,0 +1,208 @@
+// Boost result_of library
+
+// Copyright Douglas Gregor 2004. 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)
+
+// Copyright Daniel Walker, Eric Niebler, Michel Morin 2008-2012.
+// 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)
+
+// For more information, see http://www.boost.org/libs/utility
+#if !defined(BOOST_PP_IS_ITERATING)
+# error Boost result_of - do not include this file!
+#endif
+
+// CWPro8 requires an argument in a function type specialization
+#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0
+# define BOOST_RESULT_OF_ARGS void
+#else
+# define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)
+#endif
+
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
+ : mpl::if_<
+ mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
+ , boost::detail::tr1_result_of_impl<
+ typename remove_cv<F>::type,
+ typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
+ (boost::detail::has_result_type<F>::value)>
+ , boost::detail::tr1_result_of_impl<
+ F,
+ F(BOOST_RESULT_OF_ARGS),
+ (boost::detail::has_result_type<F>::value)> >::type { };
+#endif
+
+#ifdef BOOST_RESULT_OF_USE_DECLTYPE
+
+// 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))>
+ : mpl::if_<
+ is_member_function_pointer<F>
+ , detail::tr1_result_of_impl<
+ typename remove_cv<F>::type,
+ typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
+ >
+ , detail::cpp0x_result_of_impl<
+ F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
+ >
+ >::type
+{};
+
+namespace detail {
+
+#ifdef BOOST_NO_SFINAE_EXPR
+
+template<typename F>
+struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION());
+
+template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
+struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<R(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))> {
+ R operator()(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)) const;
+ typedef result_of_private_type const &(*pfn_t)(...);
+ operator pfn_t() const volatile;
+};
+
+template<typename F>
+struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION());
+
+template<typename F>
+struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F *>
+ : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F>
+{};
+
+template<typename F>
+struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F &>
+ : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F>
+{};
+
+template<typename F>
+struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())
+ : mpl::eval_if<
+ is_class<typename remove_reference<F>::type>,
+ result_of_wrap_callable_class<F>,
+ mpl::identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<F>::type> >
+ >
+{};
+
+template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
+struct BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION()) {
+ typedef typename BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())<F>::type wrapper_t;
+ static const bool value = (
+ sizeof(result_of_no_type) == sizeof(detail::result_of_is_private_type(
+ (boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), result_of_weird_type())
+ ))
+ );
+ typedef mpl::bool_<value> type;
+};
+
+template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), true>
+ : lazy_enable_if<
+ BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION())<F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), T)>
+ , cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false>
+ >
+{};
+
+template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false>
+{
+ typedef decltype(
+ boost::declval<F>()(
+ BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
+ )
+ ) type;
+};
+
+#else // BOOST_NO_SFINAE_EXPR
+
+template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)),
+ typename result_of_always_void<decltype(
+ boost::declval<F>()(
+ BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
+ )
+ )>::type> {
+ typedef decltype(
+ boost::declval<F>()(
+ BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
+ )
+ ) type;
+};
+
+#endif // BOOST_NO_SFINAE_EXPR
+
+} // namespace detail
+
+#else // defined(BOOST_RESULT_OF_USE_DECLTYPE)
+
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct result_of<F(BOOST_RESULT_OF_ARGS)>
+ : tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { };
+#endif
+
+#endif // defined(BOOST_RESULT_OF_USE_DECLTYPE)
+
+#undef BOOST_RESULT_OF_ARGS
+
+#if BOOST_PP_ITERATION() >= 1
+
+namespace detail {
+
+template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
+{
+ typedef R type;
+};
+
+template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
+{
+ typedef R type;
+};
+
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of_impl<R (T0::*)
+ (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
+ FArgs, false>
+{
+ typedef R type;
+};
+
+template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of_impl<R (T0::*)
+ (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
+ const,
+ FArgs, false>
+{
+ typedef R type;
+};
+
+template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of_impl<R (T0::*)
+ (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
+ volatile,
+ FArgs, false>
+{
+ typedef R type;
+};
+
+template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
+struct tr1_result_of_impl<R (T0::*)
+ (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
+ const volatile,
+ FArgs, false>
+{
+ typedef R type;
+};
+#endif
+
+}
+#endif
diff --git a/3rdParty/Boost/src/boost/utility/identity_type.hpp b/3rdParty/Boost/src/boost/utility/identity_type.hpp
new file mode 100644
index 0000000..4a1f6c4
--- /dev/null
+++ b/3rdParty/Boost/src/boost/utility/identity_type.hpp
@@ -0,0 +1,46 @@
+
+// Copyright (C) 2009-2012 Lorenzo Caminiti
+// Distributed under 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)
+// Home at http://www.boost.org/libs/utility/identity_type
+
+/** @file
+Wrap type expressions with round parenthesis so they can be passed to macros
+even if they contain commas.
+*/
+
+#ifndef BOOST_IDENTITY_TYPE_HPP_
+#define BOOST_IDENTITY_TYPE_HPP_
+
+#include <boost/type_traits/function_traits.hpp>
+
+/**
+@brief This macro allows to wrap the specified type expression within extra
+round parenthesis so the type can be passed as a single macro parameter even if
+it contains commas (not already wrapped within round parenthesis).
+
+@Params
+@Param{parenthesized_type,
+The type expression to be passed as macro parameter wrapped by a single set
+of round parenthesis <c>(...)</c>.
+This type expression can contain an arbitrary number of commas.
+}
+@EndParams
+
+This macro works on any C++03 compiler (it does not use variadic macros).
+
+This macro must be prefixed by <c>typename</c> when used within templates.
+Note that the compiler will not be able to automatically determine function
+template parameters when they are wrapped with this macro (these parameters
+need to be explicitly specified when calling the function template).
+
+On some compilers (like GCC), using this macro on abstract types requires to
+add and remove a reference to the specified type.
+*/
+#define BOOST_IDENTITY_TYPE(parenthesized_type) \
+ /* must NOT prefix this with `::` to work with parenthesized syntax */ \
+ boost::function_traits< void parenthesized_type >::arg1_type
+
+#endif // #include guard
+
diff --git a/3rdParty/Boost/src/boost/utility/result_of.hpp b/3rdParty/Boost/src/boost/utility/result_of.hpp
new file mode 100644
index 0000000..f0e084a
--- /dev/null
+++ b/3rdParty/Boost/src/boost/utility/result_of.hpp
@@ -0,0 +1,187 @@
+// Boost result_of library
+
+// Copyright Douglas Gregor 2004. 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)
+
+// For more information, see http://www.boost.org/libs/utility
+#ifndef BOOST_RESULT_OF_HPP
+#define BOOST_RESULT_OF_HPP
+
+#include <boost/config.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/iteration/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
+#include <boost/preprocessor/facilities/intercept.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_member_function_pointer.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/declval.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#ifndef BOOST_RESULT_OF_NUM_ARGS
+# define BOOST_RESULT_OF_NUM_ARGS 16
+#endif
+
+// 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.
+#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
+# endif
+# endif
+#endif
+
+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)
+namespace detail {
+
+BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
+
+template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl;
+
+#ifdef BOOST_NO_SFINAE_EXPR
+
+struct result_of_private_type {};
+
+struct result_of_weird_type {
+ friend result_of_private_type operator,(result_of_private_type, result_of_weird_type);
+};
+
+typedef char result_of_yes_type; // sizeof(result_of_yes_type) == 1
+typedef char (&result_of_no_type)[2]; // sizeof(result_of_no_type) == 2
+
+template<typename T>
+result_of_no_type result_of_is_private_type(T const &);
+result_of_yes_type result_of_is_private_type(result_of_private_type);
+
+template<typename C>
+struct result_of_callable_class : C {
+ result_of_callable_class();
+ typedef result_of_private_type const &(*pfn_t)(...);
+ operator pfn_t() const volatile;
+};
+
+template<typename C>
+struct result_of_wrap_callable_class {
+ typedef result_of_callable_class<C> type;
+};
+
+template<typename C>
+struct result_of_wrap_callable_class<C const> {
+ typedef result_of_callable_class<C> const type;
+};
+
+template<typename C>
+struct result_of_wrap_callable_class<C volatile> {
+ typedef result_of_callable_class<C> volatile type;
+};
+
+template<typename C>
+struct result_of_wrap_callable_class<C const volatile> {
+ typedef result_of_callable_class<C> const volatile type;
+};
+
+template<typename C>
+struct result_of_wrap_callable_class<C &> {
+ typedef typename result_of_wrap_callable_class<C>::type &type;
+};
+
+template<typename F, bool TestCallability = true> struct cpp0x_result_of_impl;
+
+#else // BOOST_NO_SFINAE_EXPR
+
+template<typename T>
+struct result_of_always_void
+{
+ typedef void type;
+};
+
+template<typename F, typename Enable = void> struct cpp0x_result_of_impl {};
+
+#endif // BOOST_NO_SFINAE_EXPR
+
+template<typename F>
+struct result_of_void_impl
+{
+ typedef void type;
+};
+
+template<typename R>
+struct result_of_void_impl<R (*)(void)>
+{
+ typedef R type;
+};
+
+template<typename R>
+struct result_of_void_impl<R (&)(void)>
+{
+ typedef R type;
+};
+
+// Determine the return type of a function pointer or pointer to member.
+template<typename F, typename FArgs>
+struct result_of_pointer
+ : tr1_result_of_impl<typename remove_cv<F>::type, FArgs, false> { };
+
+template<typename F, typename FArgs>
+struct tr1_result_of_impl<F, FArgs, true>
+{
+ typedef typename F::result_type type;
+};
+
+template<typename FArgs>
+struct is_function_with_no_args : mpl::false_ {};
+
+template<typename F>
+struct is_function_with_no_args<F(void)> : mpl::true_ {};
+
+template<typename F, typename FArgs>
+struct result_of_nested_result : F::template result<FArgs>
+{};
+
+template<typename F, typename FArgs>
+struct tr1_result_of_impl<F, FArgs, false>
+ : mpl::if_<is_function_with_no_args<FArgs>,
+ result_of_void_impl<F>,
+ result_of_nested_result<F, FArgs> >::type
+{};
+
+} // end namespace detail
+
+#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>))
+#include BOOST_PP_ITERATE()
+
+#else
+# define BOOST_NO_RESULT_OF 1
+#endif
+
+}
+
+#endif // BOOST_RESULT_OF_HPP
diff --git a/3rdParty/Boost/src/boost/utility/value_init.hpp b/3rdParty/Boost/src/boost/utility/value_init.hpp
new file mode 100644
index 0000000..5de9585
--- /dev/null
+++ b/3rdParty/Boost/src/boost/utility/value_init.hpp
@@ -0,0 +1,258 @@
+// (C) Copyright 2002-2008, Fernando Luis Cacciola Carballal.
+//
+// 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)
+//
+// 21 Ago 2002 (Created) Fernando Cacciola
+// 24 Dec 2007 (Refactored and worked around various compiler bugs) Fernando Cacciola, Niels Dekker
+// 23 May 2008 (Fixed operator= const issue, added initialized_value) Niels Dekker, Fernando Cacciola
+// 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola
+// 20 Feb 2009 (Fixed logical const-ness issues) Niels Dekker, Fernando Cacciola
+// 03 Apr 2010 (Added initialized<T>, suggested by Jeffrey Hellrung, fixing #3472) Niels Dekker
+// 30 May 2010 (Made memset call conditional, fixing #3869) Niels Dekker
+//
+#ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
+#define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
+
+// Note: The implementation of boost::value_initialized had to deal with the
+// fact that various compilers haven't fully implemented value-initialization.
+// The constructor of boost::value_initialized<T> works around these compiler
+// issues, by clearing the bytes of T, before constructing the T object it
+// contains. More details on these issues are at libs/utility/value_init.htm
+
+#include <boost/aligned_storage.hpp>
+#include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION.
+#include <boost/detail/workaround.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/cv_traits.hpp>
+#include <boost/type_traits/alignment_of.hpp>
+#include <boost/swap.hpp>
+#include <cstring>
+#include <new>
+
+#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)
+// It is safe to ignore the following MSVC warning, which may pop up when T is
+// 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
+ // suggests that a workaround should be applied, because of compiler issues
+ // regarding value-initialization.
+ #define BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
+#endif
+
+// Implementation detail: The macro BOOST_DETAIL_VALUE_INIT_WORKAROUND
+// switches the value-initialization workaround either on or off.
+#ifndef BOOST_DETAIL_VALUE_INIT_WORKAROUND
+ #ifdef BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
+ #define BOOST_DETAIL_VALUE_INIT_WORKAROUND 1
+ #else
+ #define BOOST_DETAIL_VALUE_INIT_WORKAROUND 0
+ #endif
+#endif
+
+namespace boost {
+
+template<class T>
+class initialized
+{
+ private :
+ struct wrapper
+ {
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
+ typename
+#endif
+ remove_const<T>::type data;
+
+ wrapper()
+ :
+ data()
+ {
+ }
+
+ wrapper(T const & arg)
+ :
+ data(arg)
+ {
+ }
+ };
+
+ mutable
+#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
+ typename
+#endif
+ aligned_storage<sizeof(wrapper), alignment_of<wrapper>::value>::type x;
+
+ wrapper * wrapper_address() const
+ {
+ return static_cast<wrapper *>( static_cast<void*>(&x));
+ }
+
+ public :
+
+ initialized()
+ {
+#if BOOST_DETAIL_VALUE_INIT_WORKAROUND
+ std::memset(&x, 0, sizeof(x));
+#endif
+ new (wrapper_address()) wrapper();
+ }
+
+ initialized(initialized const & arg)
+ {
+ new (wrapper_address()) wrapper( static_cast<wrapper const &>(*(arg.wrapper_address())));
+ }
+
+ explicit initialized(T const & arg)
+ {
+ new (wrapper_address()) wrapper(arg);
+ }
+
+ initialized & operator=(initialized const & arg)
+ {
+ // Assignment is only allowed when T is non-const.
+ BOOST_STATIC_ASSERT( ! is_const<T>::value );
+ *wrapper_address() = static_cast<wrapper const &>(*(arg.wrapper_address()));
+ return *this;
+ }
+
+ ~initialized()
+ {
+ wrapper_address()->wrapper::~wrapper();
+ }
+
+ T const & data() const
+ {
+ return wrapper_address()->data;
+ }
+
+ T& data()
+ {
+ return wrapper_address()->data;
+ }
+
+ void swap(initialized & arg)
+ {
+ ::boost::swap( this->data(), arg.data() );
+ }
+
+ operator T const &() const
+ {
+ return wrapper_address()->data;
+ }
+
+ operator T&()
+ {
+ return wrapper_address()->data;
+ }
+
+} ;
+
+template<class T>
+T const& get ( initialized<T> const& x )
+{
+ return x.data() ;
+}
+
+template<class T>
+T& get ( initialized<T>& x )
+{
+ return x.data() ;
+}
+
+template<class T>
+void swap ( initialized<T> & lhs, initialized<T> & rhs )
+{
+ lhs.swap(rhs) ;
+}
+
+template<class T>
+class value_initialized
+{
+ private :
+
+ // initialized<T> does value-initialization by default.
+ initialized<T> m_data;
+
+ public :
+
+ value_initialized()
+ :
+ m_data()
+ { }
+
+ T const & data() const
+ {
+ return m_data.data();
+ }
+
+ T& data()
+ {
+ return m_data.data();
+ }
+
+ void swap(value_initialized & arg)
+ {
+ m_data.swap(arg.m_data);
+ }
+
+ operator T const &() const
+ {
+ return m_data;
+ }
+
+ operator T&()
+ {
+ return m_data;
+ }
+} ;
+
+
+template<class T>
+T const& get ( value_initialized<T> const& x )
+{
+ return x.data() ;
+}
+
+template<class T>
+T& get ( value_initialized<T>& x )
+{
+ return x.data() ;
+}
+
+template<class T>
+void swap ( value_initialized<T> & lhs, value_initialized<T> & rhs )
+{
+ lhs.swap(rhs) ;
+}
+
+
+class initialized_value_t
+{
+ public :
+
+ template <class T> operator T() const
+ {
+ return initialized<T>().data();
+ }
+};
+
+initialized_value_t const initialized_value = {} ;
+
+
+} // namespace boost
+
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+#endif