diff --git a/include/boost/type_traits/is_function.hpp b/include/boost/type_traits/is_function.hpp index e0b057a..da3e1f9 100644 --- a/include/boost/type_traits/is_function.hpp +++ b/include/boost/type_traits/is_function.hpp @@ -15,6 +15,238 @@ #include #include +#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES + +namespace boost { + + template + struct is_function : public false_type {}; + +#if __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 + +#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 + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + + // reference qualified: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + + // rvalue reference qualified: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_function : public true_type {}; +#endif + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + template + struct is_function : public true_type {}; + + +#endif // _MSC_VER + + +} + +#undef BOOST_TT_NOEXCEPT_DECL +#undef BOOST_TT_NOEXCEPT_PARAM +#undef BOOST_TT_DEF_CALL + +#else + #if !defined(BOOST_TT_TEST_MS_FUNC_SIGS) # include #else @@ -107,4 +339,6 @@ template struct is_function : public false_type {}; #include #endif +#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..86cd070 100644 --- a/include/boost/type_traits/is_member_function_pointer.hpp +++ b/include/boost/type_traits/is_member_function_pointer.hpp @@ -14,6 +14,269 @@ #include #include +#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES + +#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 __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 + +#ifdef _MSC_VER +#define BOOST_TT_DEF_CALL __thiscall +#else +#define BOOST_TT_DEF_CALL +#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 + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + + // reference qualified: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + 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 + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // const: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; + // const volatile: +#ifdef __CLR_VER + template + struct is_member_function_pointer : public true_type {}; +#endif + 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 {}; + template + struct is_member_function_pointer : public true_type {}; +#endif +} + +#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES + #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) // // Note: we use the "workaround" version for MSVC because it works for @@ -117,4 +380,6 @@ struct is_member_function_pointer } // namespace boost +#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES + #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..80f8b68 100644 --- a/test/is_function_test.cpp +++ b/test/is_function_test.cpp @@ -12,6 +12,19 @@ #include "test.hpp" #include "check_integral_constant.hpp" +struct X +{ + void f() {} + void fc() const {} + void fv() volatile {} + void fcv() const volatile {} +}; + +template< class C, class F > void test_cv_qual(F C::*) +{ + BOOST_CHECK_INTEGRAL_CONSTANT(boost::is_function< F >::value, true); +} + TT_TEST_BEGIN(is_function) typedef void foo0_t(); @@ -72,6 +85,15 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_function::value, true); #endif +#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES + +test_cv_qual(&X::f); +test_cv_qual(&X::fc); +test_cv_qual(&X::fv); +test_cv_qual(&X::fcv); + +#endif + TT_TEST_END