diff --git a/include/boost/type_traits/detail/config.hpp b/include/boost/type_traits/detail/config.hpp index 2113c43..9cd1934 100644 --- a/include/boost/type_traits/detail/config.hpp +++ b/include/boost/type_traits/detail/config.hpp @@ -78,6 +78,15 @@ #undef BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION #endif +// +// Can we implement accurate is_function/is_member_function_pointer (post C++03)? +// +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !BOOST_WORKAROUND(BOOST_GCC, <= 40800)\ + && !BOOST_WORKAROUND(BOOST_MSVC, < 1900) && !BOOST_WORKAROUND(__clang_major__, <= 4) +# define BOOST_TT_HAS_ASCCURATE_IS_FUNCTION +#endif + + #endif // BOOST_TT_CONFIG_HPP_INCLUDED diff --git a/include/boost/type_traits/detail/is_function_cxx_03.hpp b/include/boost/type_traits/detail/is_function_cxx_03.hpp new file mode 100644 index 0000000..d3e4f93 --- /dev/null +++ b/include/boost/type_traits/detail/is_function_cxx_03.hpp @@ -0,0 +1,108 @@ + +// Copyright 2000 John Maddock (john@johnmaddock.co.uk) +// Copyright 2002 Aleksey Gurtovoy (agurtovoy@meta-comm.com) +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_FUNCTION_CXX_03_HPP_INCLUDED +#define BOOST_TT_IS_FUNCTION_CXX_03_HPP_INCLUDED + +#include + +#if !defined(BOOST_TT_TEST_MS_FUNC_SIGS) +# include +#else +# include +# include +#endif + +// is a type a function? +// Please note that this implementation is unnecessarily complex: +// we could just use !is_convertible::value, +// except that some compilers erroneously allow conversions from +// function pointers to void*. + +namespace boost { + +#if !defined( __CODEGEARC__ ) + +namespace detail { + +#if !defined(BOOST_TT_TEST_MS_FUNC_SIGS) +template +struct is_function_chooser +{ + template< typename T > struct result_ + : public false_type {}; +}; + +template <> +struct is_function_chooser +{ + template< typename T > struct result_ + : public ::boost::type_traits::is_function_ptr_helper {}; +}; + +template +struct is_function_impl + : public is_function_chooser< ::boost::is_reference::value > + ::BOOST_NESTED_TEMPLATE result_ +{ +}; + +#else + +template +struct is_function_impl +{ +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(push) +#pragma warning(disable:6334) +#endif + static T* t; + BOOST_STATIC_CONSTANT( + bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t)) + == sizeof(::boost::type_traits::yes_type) + ); +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(pop) +#endif +}; + +template +struct is_function_impl : public false_type +{}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template +struct is_function_impl : public false_type +{}; +#endif + +#endif + +} // namespace detail + +#endif // !defined( __CODEGEARC__ ) + +#if defined( __CODEGEARC__ ) +template struct is_function : integral_constant {}; +#else +template struct is_function : integral_constant::value> {}; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template struct is_function : public false_type {}; +#endif +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1600) +template struct is_function : public false_type {}; +#endif +#endif +} // namespace boost + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1700) +#include +#endif + +#endif // BOOST_TT_IS_FUNCTION_CXX_03_HPP_INCLUDED diff --git a/include/boost/type_traits/detail/is_function_cxx_11.hpp b/include/boost/type_traits/detail/is_function_cxx_11.hpp new file mode 100644 index 0000000..3031130 --- /dev/null +++ b/include/boost/type_traits/detail/is_function_cxx_11.hpp @@ -0,0 +1,501 @@ + +// Copyright 2000 John Maddock (john@johnmaddock.co.uk) +// Copyright 2002 Aleksey Gurtovoy (agurtovoy@meta-comm.com) +// +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_FUNCTION_CXX_11_HPP_INCLUDED +#define BOOST_TT_IS_FUNCTION_CXX_11_HPP_INCLUDED + +#include + +namespace boost { + + template + struct is_function : public false_type {}; + +#if defined(__cpp_noexcept_function_type) && !defined(_MSC_VER) +#define BOOST_TT_NOEXCEPT_PARAM , bool NE +#define BOOST_TT_NOEXCEPT_DECL noexcept(NE) +#else +#define BOOST_TT_NOEXCEPT_PARAM +#define BOOST_TT_NOEXCEPT_DECL +#endif + +#ifdef _MSC_VER +#define BOOST_TT_DEF_CALL __cdecl +#else +#define BOOST_TT_DEF_CALL +#endif + + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const qualified: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + + // Reference qualified: + + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const qualified: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + + // rvalue reference qualified: + + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const qualified: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + +#ifdef _MSC_VER +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + + // reference qualified: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + + // rvalue reference qualified: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + +#endif // _MSC_VER + + // All over again for msvc with noexcept: + +#if defined(_MSVC_LANG) && (_MSVC_LANG >= 201703) + +#undef BOOST_TT_NOEXCEPT_DECL +#define BOOST_TT_NOEXCEPT_DECL noexcept + + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const qualified: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + + // Reference qualified: + + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const qualified: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + + // rvalue reference qualified: + + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const qualified: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + +#ifdef _MSC_VER +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + + // reference qualified: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + + // rvalue reference qualified: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + +#endif // _MSC_VER + +#endif + +} + +#undef BOOST_TT_NOEXCEPT_DECL +#undef BOOST_TT_NOEXCEPT_PARAM +#undef BOOST_TT_DEF_CALL + +#endif // BOOST_TT_IS_FUNCTION_CXX_11_HPP_INCLUDED + diff --git a/include/boost/type_traits/detail/is_member_function_pointer_cxx_03.hpp b/include/boost/type_traits/detail/is_member_function_pointer_cxx_03.hpp new file mode 100644 index 0000000..3df5b4e --- /dev/null +++ b/include/boost/type_traits/detail/is_member_function_pointer_cxx_03.hpp @@ -0,0 +1,117 @@ + +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_IS_MEMBER_FUNCTION_POINTER_CXX_03_HPP_INCLUDED +#define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_CXX_03_HPP_INCLUDED + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) + // + // Note: we use the "workaround" version for MSVC because it works for + // __stdcall etc function types, where as the partial specialisation + // version does not do so. + // +# include +# include +# include +#else +# include +# include +# include +# include +#endif + +namespace boost { + +#if defined( __CODEGEARC__ ) +template struct is_member_function_pointer : public integral_constant {}; +#elif !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) + +template struct is_member_function_pointer + : public ::boost::integral_constant::type>::value>{}; + +#else + +namespace detail { + +#ifndef __BORLANDC__ + +template +struct is_mem_fun_pointer_select +{ + template struct result_ : public false_type{}; +}; + +template <> +struct is_mem_fun_pointer_select +{ + template struct result_ + { +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(push) +#pragma warning(disable:6334) +#endif + static T* make_t; + typedef result_ self_type; + + BOOST_STATIC_CONSTANT( + bool, value = ( + 1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t)) + )); +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(pop) +#endif + }; +}; + +template +struct is_member_function_pointer_impl + : public is_mem_fun_pointer_select< + ::boost::is_reference::value || ::boost::is_array::value>::template result_{}; + +template +struct is_member_function_pointer_impl : public false_type{}; + +#else // Borland C++ + +template +struct is_member_function_pointer_impl +{ + static T* m_t; + BOOST_STATIC_CONSTANT( + bool, value = + (1 == sizeof(type_traits::is_mem_fun_pointer_tester(m_t))) ); +}; + +template +struct is_member_function_pointer_impl +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +#endif + +template<> struct is_member_function_pointer_impl : public false_type{}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template<> struct is_member_function_pointer_impl : public false_type{}; +template<> struct is_member_function_pointer_impl : public false_type{}; +template<> struct is_member_function_pointer_impl : public false_type{}; +#endif + +} // namespace detail + +template +struct is_member_function_pointer + : public integral_constant::value>{}; + +#endif + +} // namespace boost + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/include/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp b/include/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp new file mode 100644 index 0000000..b77a4a5 --- /dev/null +++ b/include/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp @@ -0,0 +1,557 @@ + +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. +// Use, modification and distribution are 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). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + + +#ifndef BOOST_TT_IS_MEMBER_FUNCTION_POINTER_CXX_11_HPP_INCLUDED +#define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_CXX_11_HPP_INCLUDED + +#include + +namespace boost { + +#ifdef _MSC_VER +#define BOOST_TT_DEF_CALL __thiscall +#else +#define BOOST_TT_DEF_CALL +#endif + + + template + struct is_member_function_pointer : public false_type {}; + template + struct is_member_function_pointer : public is_member_function_pointer {}; + template + struct is_member_function_pointer : public is_member_function_pointer {}; + template + struct is_member_function_pointer : public is_member_function_pointer {}; + +#if defined(_MSVC_LANG) && (_MSVC_LANG >= 201703) + // MSVC can't handle noexcept(b) as a deduced template parameter + // so we will have to write everything out :( +#define BOOST_TT_NOEXCEPT_PARAM +#define BOOST_TT_NOEXCEPT_DECL +#elif defined(__cpp_noexcept_function_type) +#define BOOST_TT_NOEXCEPT_PARAM , bool NE +#define BOOST_TT_NOEXCEPT_DECL noexcept(NE) +#else +#define BOOST_TT_NOEXCEPT_PARAM +#define BOOST_TT_NOEXCEPT_DECL +#endif + + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const qualified: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + + // Reference qualified: + + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const qualified: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + + // rvalue reference qualified: + + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const qualified: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + +#ifdef _MSC_VER +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + + // reference qualified: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + + // rvalue reference qualified: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; +#endif + + +#if defined(_MSVC_LANG) && (_MSVC_LANG >= 201703) + +#undef BOOST_TT_NOEXCEPT_DECL +#define BOOST_TT_NOEXCEPT_DECL noexcept + + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const qualified: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + + // Reference qualified: + + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const qualified: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + + // rvalue reference qualified: + + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const qualified: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + +#ifdef _MSC_VER +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + + // reference qualified: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + + // rvalue reference qualified: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif +#ifndef _M_AMD64 + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; + template + struct is_member_function_pointer : public true_type {}; +#endif + template + struct is_member_function_pointer : public true_type {}; +#endif + + +#endif + +#undef BOOST_TT_NOEXCEPT_DECL +#undef BOOST_TT_NOEXCEPT_PARAM +#undef BOOST_TT_DEF_CALL +} + +#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_CXX_11_HPP_INCLUDED diff --git a/include/boost/type_traits/has_trivial_move_constructor.hpp b/include/boost/type_traits/has_trivial_move_constructor.hpp index 2ecfc36..ce85dc2 100644 --- a/include/boost/type_traits/has_trivial_move_constructor.hpp +++ b/include/boost/type_traits/has_trivial_move_constructor.hpp @@ -20,6 +20,7 @@ #if defined(BOOST_MSVC) || defined(BOOST_INTEL) #include #include +#include #endif #if defined(__GNUC__) || defined(__clang__) diff --git a/include/boost/type_traits/is_function.hpp b/include/boost/type_traits/is_function.hpp index e0b057a..48672b5 100644 --- a/include/boost/type_traits/is_function.hpp +++ b/include/boost/type_traits/is_function.hpp @@ -11,100 +11,17 @@ #ifndef BOOST_TT_IS_FUNCTION_HPP_INCLUDED #define BOOST_TT_IS_FUNCTION_HPP_INCLUDED -#include #include #include -#if !defined(BOOST_TT_TEST_MS_FUNC_SIGS) -# include -#else -# include -# include -#endif +#ifdef BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION -// is a type a function? -// Please note that this implementation is unnecessarily complex: -// we could just use !is_convertible::value, -// except that some compilers erroneously allow conversions from -// function pointers to void*. - -namespace boost { - -#if !defined( __CODEGEARC__ ) - -namespace detail { - -#if !defined(BOOST_TT_TEST_MS_FUNC_SIGS) -template -struct is_function_chooser -{ - template< typename T > struct result_ - : public false_type {}; -}; - -template <> -struct is_function_chooser -{ - template< typename T > struct result_ - : public ::boost::type_traits::is_function_ptr_helper {}; -}; - -template -struct is_function_impl - : public is_function_chooser< ::boost::is_reference::value > - ::BOOST_NESTED_TEMPLATE result_ -{ -}; +#include #else -template -struct is_function_impl -{ -#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) -#pragma warning(push) -#pragma warning(disable:6334) -#endif - static T* t; - BOOST_STATIC_CONSTANT( - bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t)) - == sizeof(::boost::type_traits::yes_type) - ); -#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) -#pragma warning(pop) -#endif -}; +#include -template -struct is_function_impl : public false_type -{}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template -struct is_function_impl : public false_type -{}; -#endif - -#endif - -} // namespace detail - -#endif // !defined( __CODEGEARC__ ) - -#if defined( __CODEGEARC__ ) -template struct is_function : integral_constant {}; -#else -template struct is_function : integral_constant::value> {}; -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template struct is_function : public false_type {}; -#endif -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1600) -template struct is_function : public false_type {}; -#endif -#endif -} // namespace boost - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1700) -#include #endif #endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED diff --git a/include/boost/type_traits/is_member_function_pointer.hpp b/include/boost/type_traits/is_member_function_pointer.hpp index 223197f..9b5dbbf 100644 --- a/include/boost/type_traits/is_member_function_pointer.hpp +++ b/include/boost/type_traits/is_member_function_pointer.hpp @@ -12,109 +12,15 @@ #define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED #include -#include -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) - // - // Note: we use the "workaround" version for MSVC because it works for - // __stdcall etc function types, where as the partial specialisation - // version does not do so. - // -# include -# include -# include -#else -# include -# include -# include -# include -#endif +#ifdef BOOST_TT_HAS_ASCCURATE_IS_FUNCTION -namespace boost { - -#if defined( __CODEGEARC__ ) -template struct is_member_function_pointer : public integral_constant {}; -#elif !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) - -template struct is_member_function_pointer - : public ::boost::integral_constant::type>::value>{}; +#include #else -namespace detail { - -#ifndef __BORLANDC__ - -template -struct is_mem_fun_pointer_select -{ - template struct result_ : public false_type{}; -}; - -template <> -struct is_mem_fun_pointer_select -{ - template struct result_ - { -#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) -#pragma warning(push) -#pragma warning(disable:6334) -#endif - static T* make_t; - typedef result_ self_type; - - BOOST_STATIC_CONSTANT( - bool, value = ( - 1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t)) - )); -#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) -#pragma warning(pop) -#endif - }; -}; - -template -struct is_member_function_pointer_impl - : public is_mem_fun_pointer_select< - ::boost::is_reference::value || ::boost::is_array::value>::template result_{}; - -template -struct is_member_function_pointer_impl : public false_type{}; - -#else // Borland C++ - -template -struct is_member_function_pointer_impl -{ - static T* m_t; - BOOST_STATIC_CONSTANT( - bool, value = - (1 == sizeof(type_traits::is_mem_fun_pointer_tester(m_t))) ); -}; - -template -struct is_member_function_pointer_impl -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; +#include #endif -template<> struct is_member_function_pointer_impl : public false_type{}; -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template<> struct is_member_function_pointer_impl : public false_type{}; -template<> struct is_member_function_pointer_impl : public false_type{}; -template<> struct is_member_function_pointer_impl : public false_type{}; -#endif - -} // namespace detail - -template -struct is_member_function_pointer - : public integral_constant::value>{}; - -#endif - -} // namespace boost - #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/test/is_function_test.cpp b/test/is_function_test.cpp index d694eca..1cb0423 100644 --- a/test/is_function_test.cpp +++ b/test/is_function_test.cpp @@ -12,6 +12,30 @@ #include "test.hpp" #include "check_integral_constant.hpp" +#if defined(BOOST_GCC) && (BOOST_GCC >= 70000) +#pragma GCC diagnostic ignored "-Wnoexcept-type" +#endif + +#ifdef BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + +struct X +{ + void f() {} + void fc() const {} + void fv() volatile {} + void fcv() const volatile {} + void noexcept_f()noexcept {} + void ref_f()const& {} + void rvalue_f() && {} +}; + +template< class C, class F > void test_cv_qual(F C::*) +{ + BOOST_CHECK_INTEGRAL_CONSTANT(boost::is_function< F >::value, true); +} + +#endif + TT_TEST_BEGIN(is_function) typedef void foo0_t(); @@ -72,6 +96,18 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_function::value, true); #endif +#ifdef BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + +test_cv_qual(&X::f); +test_cv_qual(&X::fc); +test_cv_qual(&X::fv); +test_cv_qual(&X::fcv); +test_cv_qual(&X::noexcept_f); +test_cv_qual(&X::ref_f); +test_cv_qual(&X::rvalue_f); + +#endif + TT_TEST_END diff --git a/test/is_member_func_test.cpp b/test/is_member_func_test.cpp index 2473cad..94b040a 100644 --- a/test/is_member_func_test.cpp +++ b/test/is_member_func_test.cpp @@ -12,6 +12,28 @@ #include "test.hpp" #include "check_integral_constant.hpp" +#if defined(BOOST_GCC) && (BOOST_GCC >= 70000) +#pragma GCC diagnostic ignored "-Wnoexcept-type" +#endif + +#ifdef BOOST_TT_HAS_ASCCURATE_IS_FUNCTION +struct tricky_members +{ + void noexcept_proc()noexcept + {} + void const_ref_proc()const & + {} + void rvalue_proc()&& + {} +}; + +template +void test_tricky(T) +{ + BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer::value, true); +} +#endif + TT_TEST_BEGIN(is_member_function_pointer) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer::value, false); @@ -53,12 +75,12 @@ typedef void (__cdecl test_abc1::*ccall_proc)(int, long, double); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer::value, true); #endif +#ifdef BOOST_TT_HAS_ASCCURATE_IS_FUNCTION +test_tricky(&tricky_members::const_ref_proc); +test_tricky(&tricky_members::noexcept_proc); +test_tricky(&tricky_members::rvalue_proc); +#endif + TT_TEST_END - - - - - -