diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-12-23 13:16:26 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-12-23 14:43:26 (GMT) |
commit | 491ddd570a752cf9bda85933bed0c6942e39b1f9 (patch) | |
tree | 10c25c1be8cc08d0497df1dccd56a10fbb30beee /3rdParty/Boost/src/boost/utility | |
parent | da7d7a0ca71b80281aa9ff2526290b61ccb0cc60 (diff) | |
download | swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.zip swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.tar.bz2 |
Update Boost to 1.52.0.
Change-Id: I1e56bea2600bf2ed9c5b3aba8c4f9d2a0f350e77
Diffstat (limited to '3rdParty/Boost/src/boost/utility')
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/declval.hpp | 9 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp | 208 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/identity_type.hpp | 46 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/utility/result_of.hpp | 187 |
4 files changed, 448 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 |