From 7cb0e840f1b408d62ce4328da3e5e55a23f0616d Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 8 Jun 2015 01:55:17 +0300 Subject: [PATCH] Moved utility/declval.hpp to type_traits/declval.hpp. --- include/boost/type_traits.hpp | 1 + include/boost/type_traits/common_type.hpp | 2 +- include/boost/type_traits/declval.hpp | 44 +++++++++++++++++++ include/boost/type_traits/is_convertible.hpp | 2 +- .../boost/type_traits/is_copy_assignable.hpp | 2 +- .../type_traits/is_copy_constructible.hpp | 2 +- .../is_nothrow_move_assignable.hpp | 2 +- .../is_nothrow_move_constructible.hpp | 2 +- include/boost/utility/declval.hpp | 33 +------------- 9 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 include/boost/type_traits/declval.hpp diff --git a/include/boost/type_traits.hpp b/include/boost/type_traits.hpp index 0ada915..8f5f5ca 100644 --- a/include/boost/type_traits.hpp +++ b/include/boost/type_traits.hpp @@ -23,6 +23,7 @@ #include "boost/type_traits/conditional.hpp" #include "boost/type_traits/copy_cv.hpp" #include "boost/type_traits/decay.hpp" +#include "boost/type_traits/declval.hpp" #include "boost/type_traits/extent.hpp" #include "boost/type_traits/floating_point_promotion.hpp" #include "boost/type_traits/function_traits.hpp" diff --git a/include/boost/type_traits/common_type.hpp b/include/boost/type_traits/common_type.hpp index cf733f3..33ac158 100644 --- a/include/boost/type_traits/common_type.hpp +++ b/include/boost/type_traits/common_type.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include #if defined(BOOST_NO_CXX11_DECLTYPE) #include diff --git a/include/boost/type_traits/declval.hpp b/include/boost/type_traits/declval.hpp new file mode 100644 index 0000000..a050012 --- /dev/null +++ b/include/boost/type_traits/declval.hpp @@ -0,0 +1,44 @@ +// 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_DECLVAL_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_DECLVAL_HPP_INCLUDED + +#include + +//----------------------------------------------------------------------------// + +#include + +//----------------------------------------------------------------------------// +// // +// C++03 implementation of // +// 20.2.4 Function template declval [declval] // +// Written by Vicente J. Botet Escriba // +// // +// 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 +// decltype(static_cast(declval())) 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 { + + template + typename add_rvalue_reference::type declval() BOOST_NOEXCEPT; // as unevaluated operand + +} // namespace boost + +#endif // BOOST_TYPE_TRAITS_DECLVAL_HPP_INCLUDED diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index 6b4aa8d..9854f8b 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -31,7 +31,7 @@ #include #endif #if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -# include +# include #endif #elif defined(BOOST_MSVC) || defined(BOOST_INTEL) #include diff --git a/include/boost/type_traits/is_copy_assignable.hpp b/include/boost/type_traits/is_copy_assignable.hpp index a6d19aa..76afdda 100644 --- a/include/boost/type_traits/is_copy_assignable.hpp +++ b/include/boost/type_traits/is_copy_assignable.hpp @@ -18,7 +18,7 @@ && !defined(BOOST_INTEL_CXX_VERSION) && \ !(defined(BOOST_MSVC) && _MSC_VER == 1800) #define BOOST_TT_CXX11_IS_COPY_ASSIGNABLE -#include +#include #else //For compilers without decltype #include diff --git a/include/boost/type_traits/is_copy_constructible.hpp b/include/boost/type_traits/is_copy_constructible.hpp index b26543f..2e80738 100644 --- a/include/boost/type_traits/is_copy_constructible.hpp +++ b/include/boost/type_traits/is_copy_constructible.hpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include namespace boost { diff --git a/include/boost/type_traits/is_nothrow_move_assignable.hpp b/include/boost/type_traits/is_nothrow_move_assignable.hpp index c0edf37..f45d20c 100644 --- a/include/boost/type_traits/is_nothrow_move_assignable.hpp +++ b/include/boost/type_traits/is_nothrow_move_assignable.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace boost { diff --git a/include/boost/type_traits/is_nothrow_move_constructible.hpp b/include/boost/type_traits/is_nothrow_move_constructible.hpp index 09c0d88..323f443 100644 --- a/include/boost/type_traits/is_nothrow_move_constructible.hpp +++ b/include/boost/type_traits/is_nothrow_move_constructible.hpp @@ -31,7 +31,7 @@ template struct is_nothrow_move_constructible : public ::boost::f #elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) -#include +#include #include namespace boost{ namespace detail{ diff --git a/include/boost/utility/declval.hpp b/include/boost/utility/declval.hpp index a4ab2c8..229e9a3 100644 --- a/include/boost/utility/declval.hpp +++ b/include/boost/utility/declval.hpp @@ -8,37 +8,6 @@ #ifndef BOOST_UTILITY_DECLVAL_HPP #define BOOST_UTILITY_DECLVAL_HPP -#include - -//----------------------------------------------------------------------------// - -#include - -//----------------------------------------------------------------------------// -// // -// C++03 implementation of // -// 20.2.4 Function template declval [declval] // -// Written by Vicente J. Botet Escriba // -// // -// 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 -// decltype(static_cast(declval())) 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 { - - template - typename add_rvalue_reference::type declval() BOOST_NOEXCEPT; // as unevaluated operand - -} // namespace boost +#include #endif // BOOST_UTILITY_DECLVAL_HPP