From 321e79815caf455098e15cdd809f0aeee51a87da Mon Sep 17 00:00:00 2001 From: badair Date: Sat, 16 Apr 2016 03:16:25 -0500 Subject: [PATCH] GCC support back to 4.8.0 --- cmake/CheckCxxCompilerSupport.cmake | 4 +- example/add_member_const.cpp | 6 + example/add_member_cv.cpp | 6 + example/add_member_lvalue_reference.cpp | 6 + example/add_member_rvalue_reference.cpp | 7 +- example/add_member_volatile.cpp | 6 + example/args.cpp | 7 +- example/can_invoke_function_object.cpp | 5 + example/function_type.cpp | 6 + example/intro.cpp | 7 + example/remove_member_pointer.cpp | 7 + example/result_of.cpp | 6 + include/callable_traits/config.hpp | 83 ++-- .../detail/bind_expression.hpp | 8 +- include/callable_traits/detail/function.hpp | 13 +- include/callable_traits/detail/pmf_cc.hpp | 33 +- include/callable_traits/detail/qualifiers.hpp | 25 +- .../detail/set_function_qualifiers.hpp | 14 +- .../callable_traits/detail/varargs_pmf_cc.hpp | 33 +- .../is_lvalue_reference_member.hpp | 4 +- .../callable_traits/is_reference_member.hpp | 2 +- .../is_rvalue_reference_member.hpp | 4 +- include/callable_traits/max_arity.hpp | 18 +- include/callable_traits/min_arity.hpp | 19 +- scripts/windows/LLVM-vs2014-Win32-Release.bat | 6 - scripts/windows/LLVM-vs2014-x64-Debug.bat | 6 - scripts/windows/LLVM-vs2014-x64-Release.bat | 6 - test/add_member_const.cpp | 59 +-- test/add_member_cv.cpp | 60 +-- test/add_member_lvalue_reference.cpp | 7 + test/add_member_rvalue_reference.cpp | 6 + test/add_member_volatile.cpp | 44 +- test/add_varargs.cpp | 388 +++++++++--------- test/arity.cpp | 24 +- test/can_invoke.cpp | 16 +- test/can_invoke_libcxx.cpp | 7 +- test/has_member_qualifiers.cpp | 18 +- test/has_member_qualifiers_simple.cpp | 107 +++++ test/has_varargs.cpp | 165 ++++---- test/is_const_member.cpp | 68 +-- test/is_cv_member.cpp | 60 +-- test/is_lvalue_reference_member.cpp | 6 + test/is_rvalue_reference_member.cpp | 6 + test/is_volatile_member.cpp | 68 +-- test/remove_member_const.cpp | 60 +-- test/remove_member_reference.cpp | 12 +- test/remove_member_volatile.cpp | 57 ++- test/remove_varargs.cpp | 360 ++++++++-------- 48 files changed, 1194 insertions(+), 751 deletions(-) delete mode 100644 scripts/windows/LLVM-vs2014-Win32-Release.bat delete mode 100644 scripts/windows/LLVM-vs2014-x64-Debug.bat delete mode 100644 scripts/windows/LLVM-vs2014-x64-Release.bat create mode 100644 test/has_member_qualifiers_simple.cpp diff --git a/cmake/CheckCxxCompilerSupport.cmake b/cmake/CheckCxxCompilerSupport.cmake index 2f99b29..9c4855c 100644 --- a/cmake/CheckCxxCompilerSupport.cmake +++ b/cmake/CheckCxxCompilerSupport.cmake @@ -52,11 +52,11 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") ") endif() elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "5.2.1") + if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "4.8.0") message(WARNING " ### You appear to be using GCC ${CMAKE_CXX_COMPILER_VERSION}, which might ### not be able to compile CallableTraits. CallableTraits officially supports - ### GCC versions >= 5.2.1. + ### GCC versions >= 4.8.0. ") endif() else() diff --git a/example/add_member_const.cpp b/example/add_member_const.cpp index f1b76ae..f0d40c5 100644 --- a/example/add_member_const.cpp +++ b/example/add_member_const.cpp @@ -4,6 +4,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + //[ add_member_const #include #include @@ -50,3 +55,4 @@ int main() { } } //] +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/example/add_member_cv.cpp b/example/add_member_cv.cpp index e009a7f..8fd9861 100644 --- a/example/add_member_cv.cpp +++ b/example/add_member_cv.cpp @@ -4,6 +4,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + //[ add_member_cv #include #include @@ -50,3 +55,4 @@ int main() { } } //] +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/example/add_member_lvalue_reference.cpp b/example/add_member_lvalue_reference.cpp index 03fb968..7aad6ab 100644 --- a/example/add_member_lvalue_reference.cpp +++ b/example/add_member_lvalue_reference.cpp @@ -4,6 +4,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + //[ add_member_lvalue_reference #include #include @@ -53,3 +58,4 @@ int main() { } } //] +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/example/add_member_rvalue_reference.cpp b/example/add_member_rvalue_reference.cpp index 0a642b9..45219c7 100644 --- a/example/add_member_rvalue_reference.cpp +++ b/example/add_member_rvalue_reference.cpp @@ -4,6 +4,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + //[ add_member_rvalue_reference #include #include @@ -53,4 +58,4 @@ int main() { } } //] - +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/example/add_member_volatile.cpp b/example/add_member_volatile.cpp index d68e543..64aa2d4 100644 --- a/example/add_member_volatile.cpp +++ b/example/add_member_volatile.cpp @@ -4,6 +4,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + //[ add_member_volatile #include #include @@ -50,3 +55,4 @@ int main() { } } //] +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/example/args.cpp b/example/args.cpp index 1e73118..0abbba3 100644 --- a/example/args.cpp +++ b/example/args.cpp @@ -5,6 +5,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS +int main(){ return 0; } +#else + //[ args #include #include @@ -56,4 +61,4 @@ int main() { test(); } //] - +#endif //#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS diff --git a/example/can_invoke_function_object.cpp b/example/can_invoke_function_object.cpp index 6e26f9a..bcad9cc 100644 --- a/example/can_invoke_function_object.cpp +++ b/example/can_invoke_function_object.cpp @@ -4,6 +4,10 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ +#ifndef __cpp_generic_lambdas +int main(){ return 0; } +#else + //[ can_invoke_function_object #include #include @@ -69,3 +73,4 @@ static_assert(!ct::can_invoke(multiply, 1, 2, 3), ""); int main() {} //] +#endif //#ifndef __cpp_generic_lambdas diff --git a/example/function_type.cpp b/example/function_type.cpp index a0ac14d..c2b7c9e 100644 --- a/example/function_type.cpp +++ b/example/function_type.cpp @@ -5,6 +5,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS +int main(){ return 0; } +#else + //[ function_type #include #include @@ -46,3 +51,4 @@ int main() { test(); } //] +#endif //#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS diff --git a/example/intro.cpp b/example/intro.cpp index 4e34c9a..a003308 100644 --- a/example/intro.cpp +++ b/example/intro.cpp @@ -4,6 +4,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS +int main(){ return 0; } +#else + //[ intro //` This short program showcases some, but not all, of the features available in [libname]. @@ -144,3 +149,5 @@ int main() { static_assert(std::is_same::value, ""); } //] + +#endif diff --git a/example/remove_member_pointer.cpp b/example/remove_member_pointer.cpp index 7b5a67d..8398b48 100644 --- a/example/remove_member_pointer.cpp +++ b/example/remove_member_pointer.cpp @@ -4,6 +4,12 @@ Copyright (c) 2016 Barrett Adair Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ + +#include +#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS +int main(){ return 0; } +#else + //[ remove_member_pointer #include #include @@ -40,3 +46,4 @@ int main() { } } //] +#endif //#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS diff --git a/example/result_of.cpp b/example/result_of.cpp index ed758b3..3fd92c0 100644 --- a/example/result_of.cpp +++ b/example/result_of.cpp @@ -5,6 +5,11 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ +#include +#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS +int main(){ return 0; } +#else + //[ result_of #include #include @@ -34,3 +39,4 @@ int main() { test(); } //] +#endif //#ifdef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS diff --git a/include/callable_traits/config.hpp b/include/callable_traits/config.hpp index f85f5a4..8436401 100644 --- a/include/callable_traits/config.hpp +++ b/include/callable_traits/config.hpp @@ -10,6 +10,28 @@ Distributed under the Boost Software License, Version 1.0. #ifndef CALLABLE_TRAITS_CONFIG_HPP #define CALLABLE_TRAITS_CONFIG_HPP +#define CALLABLE_TRAITS_EMPTY_ +#define CALLABLE_TRAITS_EMPTY CALLABLE_TRAITS_EMPTY_ + +#if defined __GNUC__ +#if __GNUC__ >= 5 +#define CALLABLE_TRAITS_GCC_AT_LEAST_5_0_0 +#define CALLABLE_TRAITS_GCC_AT_LEAST_4_9_2 +#elif __GNUC__ == 4 && __GNUC_MINOR__ == 9 && __GNUC_PATCHLEVEL__ >= 2 +#define CALLABLE_TRAITS_GCC_AT_LEAST_4_9_2 +#else +#define CALLABLE_TRAITS_GCC_OLDER_THAN_4_9_2 +#endif //#if __GNUC__ >= 5 +#endif //#if defined __GNUC__ + +#ifdef _MSC_VER +#ifdef __clang__ +#define CALLABLE_TRAITS_CLANG_C2 +#else +#define CALLABLE_TRAITS_MSVC +#endif //#ifdef __clang__ +#endif //#ifdef _MSC_VER + #define CALLABLE_TRAITS_IX_SEQ(...) ::std::index_sequence< __VA_ARGS__ > #define CALLABLE_TRAITS_MAKE_IX_SEQ(...) ::std::make_index_sequence< __VA_ARGS__ > #define CALLABLE_TRAITS_DISJUNCTION(...) ::std::disjunction< __VA_ARGS__ > @@ -30,43 +52,48 @@ Distributed under the Boost Software License, Version 1.0. #include #endif // __cpp_lib_integer_sequence -#define CALLABLE_TRAITS_EMPTY_ -#define CALLABLE_TRAITS_EMPTY CALLABLE_TRAITS_EMPTY_ -#define CALLABLE_TRAITS_DEFAULT_VARARGS_CC +#ifdef CALLABLE_TRAITS_MSVC + + #define CALLABLE_TRAITS_DEFAULT_VARARGS_CC __cdecl + #define CALLABLE_TRAITS_PMF_VARGARGS_CDECL_DEFAULT + #define CALLABLE_TRAITS_DISABLE_BIND + #define CALLABLE_TRAITS_DISABLE_CONSTEXPR_CHECKS + + //Visual Studio 2015 Update 2 broke std::make_index_sequence + #if _MSC_FULL_VER == 190023918 + #include + #endif //#if _MSC_FULL_VER == 190023918 + +#else ////#ifdef CALLABLE_TRAITS_MSVC + #define CALLABLE_TRAITS_DEFAULT_VARARGS_CC +#endif //#ifdef CALLABLE_TRAITS_MSVC +#ifdef __GNUC__ -#ifdef _MSC_VER - -#ifndef __clang__ - -#undef CALLABLE_TRAITS_DEFAULT_VARARGS_CC -#define CALLABLE_TRAITS_DEFAULT_VARARGS_CC __cdecl -#define CALLABLE_TRAITS_PMF_VARGARGS_CDECL_DEFAULT -#define CALLABLE_TRAITS_DISABLE_BIND +#ifndef CALLABLE_TRAITS_GCC_AT_LEAST_5_0_0 #define CALLABLE_TRAITS_DISABLE_CONSTEXPR_CHECKS -#define CALLABLE_TRAITS_MSVC +#endif //#ifndef CALLABLE_TRAITS_GCC_AT_LEAST_5_0_0 -#if _MSC_FULL_VER == 190023918 -#include -#endif //#if _MSC_FULL_VER == 190023918 - -#endif //ifndef __clang__ - -#endif //_MSC_VER - - -#if defined __GNUC__ && __GNUC__ < 5 - -#define CALLABLE_TRAITS_DISABLE_CONSTEXPR_CHECKS - -#if __GNUC_MINOR__ < 9 || (__GNUC_MINOR__ == 9 && __GNUC_PATCHLEVEL__ < 2) +#ifndef CALLABLE_TRAITS_GCC_AT_LEAST_4_9_2 #define CALLABLE_TRAITS_DISABLE_BIND -#endif //#if __GNUC_MINOR__ < 9 || (__GNUC_MINOR__ == 9 && __GNUC_PATCHLEVEL__ < 2) +#define CALLABLE_TRAITS_DISABLE_ARITY_RANGE +#define CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS +#endif //#ifndef CALLABLE_TRAITS_GCC_AT_LEAST_4_9_2 -#endif //#if defined __GNUC__ && __GNUC__ < 5 +#endif //#ifdef __GNUC__ +#ifdef CALLABLE_TRAITS_GCC_OLDER_THAN_4_9_2 +#define CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS +#define CALLABLE_TRAITS_ABOMINABLE_CONST CALLABLE_TRAITS_EMPTY +#define CALLABLE_TRAITS_ABOMINABLE_VOLATILE CALLABLE_TRAITS_EMPTY +#else +#define CALLABLE_TRAITS_ABOMINABLE_CONST const +#define CALLABLE_TRAITS_ABOMINABLE_VOLATILE volatile +#endif //#ifdef CALLABLE_TRAITS_GCC_OLDER_THAN_4_9_2 + #ifndef CALLABLE_TRAITS_ARITY_SEARCH_LIMIT #define CALLABLE_TRAITS_ARITY_SEARCH_LIMIT 10 #endif //CALLABLE_TRAITS_ARITY_SEARCH_LIMIT diff --git a/include/callable_traits/detail/bind_expression.hpp b/include/callable_traits/detail/bind_expression.hpp index ec92aa9..ebf5de7 100644 --- a/include/callable_traits/detail/bind_expression.hpp +++ b/include/callable_traits/detail/bind_expression.hpp @@ -8,8 +8,8 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -#ifndef CALLABLE_TRAITS__DETAIL_BIND_EXPRESSION_HPP -#define CALLABLE_TRAITS__DETAIL_BIND_EXPRESSION_HPP +#ifndef CALLABLE_TRAITS_DETAIL_BIND_EXPRESSION_HPP +#define CALLABLE_TRAITS_DETAIL_BIND_EXPRESSION_HPP #include #include @@ -158,6 +158,8 @@ namespace callable_traits { using return_type = typename traits::return_type; using result_type = return_type; +#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + inline bind_type& get_std_bind() & { return std_bind; @@ -168,6 +170,8 @@ namespace callable_traits { return std::move(std_bind); } +#endif //#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + inline constexpr bind_expression(Callable c, Args... args) : std_bind( diff --git a/include/callable_traits/detail/function.hpp b/include/callable_traits/detail/function.hpp index f55d3bb..121d04c 100644 --- a/include/callable_traits/detail/function.hpp +++ b/include/callable_traits/detail/function.hpp @@ -160,11 +160,17 @@ namespace callable_traits { struct function : default_callable_traits {}; CALLABLE_TRAITS_SPECIALIZE_FUNCTION(CALLABLE_TRAITS_EMPTY); - CALLABLE_TRAITS_SPECIALIZE_FUNCTION(&); - CALLABLE_TRAITS_SPECIALIZE_FUNCTION(&&); + +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + CALLABLE_TRAITS_SPECIALIZE_FUNCTION(const); CALLABLE_TRAITS_SPECIALIZE_FUNCTION(volatile); CALLABLE_TRAITS_SPECIALIZE_FUNCTION(const volatile); + +#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + + CALLABLE_TRAITS_SPECIALIZE_FUNCTION(&); + CALLABLE_TRAITS_SPECIALIZE_FUNCTION(&&); CALLABLE_TRAITS_SPECIALIZE_FUNCTION(const &); CALLABLE_TRAITS_SPECIALIZE_FUNCTION(volatile &); CALLABLE_TRAITS_SPECIALIZE_FUNCTION(const volatile &); @@ -172,6 +178,9 @@ namespace callable_traits { CALLABLE_TRAITS_SPECIALIZE_FUNCTION(volatile &&); CALLABLE_TRAITS_SPECIALIZE_FUNCTION(const volatile &&); +#endif //#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + #undef CALLABLE_TRAITS_SPECIALIZE_FUNCTION // function pointers diff --git a/include/callable_traits/detail/pmf_cc.hpp b/include/callable_traits/detail/pmf_cc.hpp index e3dac85..c035260 100644 --- a/include/callable_traits/detail/pmf_cc.hpp +++ b/include/callable_traits/detail/pmf_cc.hpp @@ -10,7 +10,7 @@ DO NOT INCLUDE THIS HEADER DIRECTLY */ -#define CALLABLE_TRAITS_SPECIALIZE_PMF(QUAL) \ +#define CALLABLE_TRAITS_SPECIALIZE_PMF(QUAL, ABOM_QUAL) \ \ template \ struct add_calling_convention_t< \ @@ -52,7 +52,7 @@ struct pmf using function_object_type = Return(Args...); \ using function_type = Return(invoke_type, Args...); \ using invoke_arg_types = std::tuple; \ - using qualified_function_type = Return(Args...) QUAL; \ + using qualified_function_type = Return(Args...) ABOM_QUAL; \ using remove_varargs = OriginalType; \ \ using add_varargs = typename copy_cvr< \ @@ -106,17 +106,22 @@ struct pmf } \ /**/ -CALLABLE_TRAITS_SPECIALIZE_PMF(CALLABLE_TRAITS_EMPTY); -CALLABLE_TRAITS_SPECIALIZE_PMF(&); -CALLABLE_TRAITS_SPECIALIZE_PMF(&&); -CALLABLE_TRAITS_SPECIALIZE_PMF(const); -CALLABLE_TRAITS_SPECIALIZE_PMF(volatile); -CALLABLE_TRAITS_SPECIALIZE_PMF(const volatile); -CALLABLE_TRAITS_SPECIALIZE_PMF(const &); -CALLABLE_TRAITS_SPECIALIZE_PMF(volatile &); -CALLABLE_TRAITS_SPECIALIZE_PMF(const volatile &); -CALLABLE_TRAITS_SPECIALIZE_PMF(const &&); -CALLABLE_TRAITS_SPECIALIZE_PMF(volatile &&); -CALLABLE_TRAITS_SPECIALIZE_PMF(const volatile &&); +CALLABLE_TRAITS_SPECIALIZE_PMF(CALLABLE_TRAITS_EMPTY, CALLABLE_TRAITS_EMPTY); +CALLABLE_TRAITS_SPECIALIZE_PMF(const, CALLABLE_TRAITS_ABOMINABLE_CONST); +CALLABLE_TRAITS_SPECIALIZE_PMF(volatile, CALLABLE_TRAITS_ABOMINABLE_VOLATILE); +CALLABLE_TRAITS_SPECIALIZE_PMF(const volatile, CALLABLE_TRAITS_ABOMINABLE_CONST CALLABLE_TRAITS_ABOMINABLE_VOLATILE); + +#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + +CALLABLE_TRAITS_SPECIALIZE_PMF(&, &); +CALLABLE_TRAITS_SPECIALIZE_PMF(&&, &&); +CALLABLE_TRAITS_SPECIALIZE_PMF(const &, const &); +CALLABLE_TRAITS_SPECIALIZE_PMF(volatile &, volatile &); +CALLABLE_TRAITS_SPECIALIZE_PMF(const volatile &, const volatile &); +CALLABLE_TRAITS_SPECIALIZE_PMF(const &&, const &&); +CALLABLE_TRAITS_SPECIALIZE_PMF(volatile &&, volatile &&); +CALLABLE_TRAITS_SPECIALIZE_PMF(const volatile &&, const volatile &&); + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS #undef CALLABLE_TRAITS_SPECIALIZE_PMF diff --git a/include/callable_traits/detail/qualifiers.hpp b/include/callable_traits/detail/qualifiers.hpp index 1b205eb..51e4e9d 100644 --- a/include/callable_traits/detail/qualifiers.hpp +++ b/include/callable_traits/detail/qualifiers.hpp @@ -54,6 +54,12 @@ namespace callable_traits { //! or member function overload. constexpr flags volatile_ = 2; +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + + constexpr flags lref_ = default_; + constexpr flags rref_ = default_; +#else + //! Flag representing an lvalue reference type, or //! an lvalue-reference-qualified member function //! overload. @@ -64,6 +70,8 @@ namespace callable_traits { //! overload. constexpr flags rref_ = 8; +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + constexpr flags cv_ = 3; template @@ -134,13 +142,24 @@ namespace callable_traits { static constexpr flags q_flags = cv_flags | ref_flags; public: + using has_member_qualifiers = std::integral_constant; - using is_reference_member = std::integral_constant; - using is_lvalue_reference_qualified = std::integral_constant; - using is_rvalue_reference_qualified = std::integral_constant; using is_const_member = std::integral_constant; using is_volatile_member = std::integral_constant; using is_cv_member = std::integral_constant; + +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + + using is_reference_member = std::false_type; + using is_lvalue_reference_qualified = std::false_type; + using is_rvalue_reference_qualified = std::false_type; +#else + using is_reference_member = std::integral_constant; + using is_lvalue_reference_member = std::integral_constant; + using is_rvalue_reference_member = std::integral_constant; + +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + }; } } diff --git a/include/callable_traits/detail/set_function_qualifiers.hpp b/include/callable_traits/detail/set_function_qualifiers.hpp index 1e30f06..19a89ef 100644 --- a/include/callable_traits/detail/set_function_qualifiers.hpp +++ b/include/callable_traits/detail/set_function_qualifiers.hpp @@ -43,18 +43,26 @@ namespace callable_traits { using type = Return(Args..., ...); }; - CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(&); - CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(&&); +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(const); CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(volatile); + CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(const volatile); + +#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + + CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(&); + CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(&&); CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(const &); CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(const &&); CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(volatile &); CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(volatile &&); - CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(const volatile); CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(const volatile &); CALLABLE_TRAITS_SET_FUNCTION_QUALIFIERS(const volatile &&); +#endif //#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + template using set_function_qualifiers = typename set_function_qualifiers_t::type; diff --git a/include/callable_traits/detail/varargs_pmf_cc.hpp b/include/callable_traits/detail/varargs_pmf_cc.hpp index 27a336b..0893a92 100644 --- a/include/callable_traits/detail/varargs_pmf_cc.hpp +++ b/include/callable_traits/detail/varargs_pmf_cc.hpp @@ -10,7 +10,7 @@ DO NOT INCLUDE THIS HEADER DIRECTLY */ -#define CALLABLE_TRAITS_SPECIALIZE_PMF_VARARGS(QUAL) \ +#define CALLABLE_TRAITS_SPECIALIZE_PMF_VARARGS(QUAL, ABOM_QUAL) \ \ template \ struct add_calling_convention_t< \ @@ -56,7 +56,7 @@ struct pmf; \ - using qualified_function_type = Return(Args..., ...) QUAL; \ + using qualified_function_type = Return(Args..., ...) ABOM_QUAL; \ \ using remove_varargs = typename copy_cvr< \ Return(CALLABLE_TRAITS_CC T::*)(Args...) QUAL, \ @@ -131,17 +131,22 @@ struct pmf inline constexpr auto is_lvalue_reference_member() { - return typename detail::traits::is_lvalue_reference_qualified{}; + return typename detail::traits::is_lvalue_reference_member{}; } template inline constexpr auto is_lvalue_reference_member(T&&) { - return typename detail::traits::is_lvalue_reference_qualified{}; + return is_lvalue_reference_member(); } } diff --git a/include/callable_traits/is_reference_member.hpp b/include/callable_traits/is_reference_member.hpp index 2b88146..c9cd759 100644 --- a/include/callable_traits/is_reference_member.hpp +++ b/include/callable_traits/is_reference_member.hpp @@ -24,7 +24,7 @@ namespace callable_traits { template inline constexpr auto is_reference_member(T&&) { - return typename detail::traits::is_reference_member{}; + return is_reference_member(); } } diff --git a/include/callable_traits/is_rvalue_reference_member.hpp b/include/callable_traits/is_rvalue_reference_member.hpp index 05268c9..b13a99e 100644 --- a/include/callable_traits/is_rvalue_reference_member.hpp +++ b/include/callable_traits/is_rvalue_reference_member.hpp @@ -18,13 +18,13 @@ namespace callable_traits { template inline constexpr auto is_rvalue_reference_member() { - return typename detail::traits::is_rvalue_reference_qualified{}; + return typename detail::traits::is_rvalue_reference_member{}; } template inline constexpr auto is_rvalue_reference_member(T&&) { - return typename detail::traits::is_rvalue_reference_qualified{}; + return is_rvalue_reference_member(); } } diff --git a/include/callable_traits/max_arity.hpp b/include/callable_traits/max_arity.hpp index 88bd476..ae556c5 100644 --- a/include/callable_traits/max_arity.hpp +++ b/include/callable_traits/max_arity.hpp @@ -18,16 +18,22 @@ Distributed under the Boost Software License, Version 1.0. namespace callable_traits { - template - inline constexpr auto - max_arity(T&&) { - return detail::max_arity_t, SearchLimit>{}; - } - template inline constexpr auto max_arity() { + +#ifdef CALLABLE_TRAITS_DISABLE_ARITY_RANGE + return detail::arity_t>{}; +#else return detail::max_arity_t, SearchLimit>{}; +#endif + + } + + template + inline constexpr auto + max_arity(T&&) { + return max_arity(); } } diff --git a/include/callable_traits/min_arity.hpp b/include/callable_traits/min_arity.hpp index 5d73d66..d66a752 100644 --- a/include/callable_traits/min_arity.hpp +++ b/include/callable_traits/min_arity.hpp @@ -18,16 +18,23 @@ Distributed under the Boost Software License, Version 1.0. namespace callable_traits { - template - inline constexpr auto - min_arity(T&&) { - return detail::min_arity_t, SearchLimit>{}; - } - template inline constexpr auto min_arity() { + +#ifdef CALLABLE_TRAITS_DISABLE_ARITY_RANGE + return detail::arity_t>{}; +#else return detail::min_arity_t, SearchLimit>{}; +#endif + + } + + template + inline constexpr auto + min_arity(T&&) { + + return min_arity(); } } diff --git a/scripts/windows/LLVM-vs2014-Win32-Release.bat b/scripts/windows/LLVM-vs2014-Win32-Release.bat deleted file mode 100644 index d79df75..0000000 --- a/scripts/windows/LLVM-vs2014-Win32-Release.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -set startdir=%cd% -cd internal -call LLVM-vs2014.bat Win32 Release ..\..\..\ callable_traits -cd %startdir% diff --git a/scripts/windows/LLVM-vs2014-x64-Debug.bat b/scripts/windows/LLVM-vs2014-x64-Debug.bat deleted file mode 100644 index 513fa3b..0000000 --- a/scripts/windows/LLVM-vs2014-x64-Debug.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -set startdir=%cd% -cd internal -call LLVM-vs2014.bat x64 Debug ..\..\..\ callable_traits -cd %startdir% \ No newline at end of file diff --git a/scripts/windows/LLVM-vs2014-x64-Release.bat b/scripts/windows/LLVM-vs2014-x64-Release.bat deleted file mode 100644 index b21b409..0000000 --- a/scripts/windows/LLVM-vs2014-x64-Release.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -set startdir=%cd% -cd internal -call LLVM-vs2014.bat x64 Release ..\..\..\ callable_traits -cd %startdir% diff --git a/test/add_member_const.cpp b/test/add_member_const.cpp index d33dc3b..7e3331c 100644 --- a/test/add_member_const.cpp +++ b/test/add_member_const.cpp @@ -13,6 +13,14 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; @@ -21,17 +29,17 @@ int main() { { using f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...); - using l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) &; - using r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) && ; + using l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) LREF; + using r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) RREF ; using c = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const; - using cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &; - using cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &&; + using cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const LREF; + using cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const RREF; using v = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile; - using vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &; - using vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &&; + using vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile LREF; + using vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile RREF; using cv = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile; - using cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &; - using cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &&; + using cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile LREF; + using cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -49,17 +57,17 @@ int main() { { using f = void(foo::* volatile)(int, int); - using l = void(foo::* volatile)(int, int) &; - using r = void(foo::* volatile)(int, int) && ; + using l = void(foo::* volatile)(int, int) LREF; + using r = void(foo::* volatile)(int, int) RREF ; using c = void(foo::* volatile)(int, int) const; - using cl = void(foo::* volatile)(int, int) const &; - using cr = void(foo::* volatile)(int, int) const &&; + using cl = void(foo::* volatile)(int, int) const LREF; + using cr = void(foo::* volatile)(int, int) const RREF; using v = void(foo::* volatile)(int, int) volatile; - using vl = void(foo::* volatile)(int, int) volatile &; - using vr = void(foo::* volatile)(int, int) volatile &&; + using vl = void(foo::* volatile)(int, int) volatile LREF; + using vr = void(foo::* volatile)(int, int) volatile RREF; using cv = void(foo::* volatile)(int, int) const volatile; - using cvl = void(foo::* volatile)(int, int) const volatile &; - using cvr = void(foo::* volatile)(int, int) const volatile &&; + using cvl = void(foo::* volatile)(int, int) const volatile LREF; + using cvr = void(foo::* volatile)(int, int) const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -75,19 +83,21 @@ int main() { CT_ASSERT(std::is_same>{}); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF ; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -102,4 +112,5 @@ int main() { CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); } +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS } diff --git a/test/add_member_cv.cpp b/test/add_member_cv.cpp index 1c981fb..0361271 100644 --- a/test/add_member_cv.cpp +++ b/test/add_member_cv.cpp @@ -13,6 +13,14 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; @@ -21,17 +29,17 @@ int main() { { using f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...); - using l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) &; - using r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) && ; + using l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) LREF; + using r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) RREF; using c = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const; - using cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &; - using cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &&; + using cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const LREF; + using cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const RREF; using v = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile; - using vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &; - using vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &&; + using vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile LREF; + using vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile RREF; using cv = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile; - using cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &; - using cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &&; + using cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile LREF; + using cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -49,17 +57,17 @@ int main() { { using f = void(foo::* volatile)(int, int); - using l = void(foo::* volatile)(int, int) &; - using r = void(foo::* volatile)(int, int) && ; + using l = void(foo::* volatile)(int, int) LREF; + using r = void(foo::* volatile)(int, int) RREF; using c = void(foo::* volatile)(int, int) const; - using cl = void(foo::* volatile)(int, int) const &; - using cr = void(foo::* volatile)(int, int) const &&; + using cl = void(foo::* volatile)(int, int) const LREF; + using cr = void(foo::* volatile)(int, int) const RREF; using v = void(foo::* volatile)(int, int) volatile; - using vl = void(foo::* volatile)(int, int) volatile &; - using vr = void(foo::* volatile)(int, int) volatile &&; + using vl = void(foo::* volatile)(int, int) volatile LREF; + using vr = void(foo::* volatile)(int, int) volatile RREF; using cv = void(foo::* volatile)(int, int) const volatile; - using cvl = void(foo::* volatile)(int, int) const volatile &; - using cvr = void(foo::* volatile)(int, int) const volatile &&; + using cvl = void(foo::* volatile)(int, int) const volatile LREF; + using cvr = void(foo::* volatile)(int, int) const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -75,19 +83,21 @@ int main() { CT_ASSERT(std::is_same>{}); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -102,4 +112,6 @@ int main() { CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); } + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS } diff --git a/test/add_member_lvalue_reference.cpp b/test/add_member_lvalue_reference.cpp index d2d22ac..eb53be5 100644 --- a/test/add_member_lvalue_reference.cpp +++ b/test/add_member_lvalue_reference.cpp @@ -9,6 +9,10 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + #ifndef CT_ASSERT #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT @@ -106,3 +110,6 @@ int main() { CT_ASSERT(!std::is_same>{}); } } + +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + diff --git a/test/add_member_rvalue_reference.cpp b/test/add_member_rvalue_reference.cpp index 0f624ef..6aff8eb 100644 --- a/test/add_member_rvalue_reference.cpp +++ b/test/add_member_rvalue_reference.cpp @@ -9,6 +9,10 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + #ifndef CT_ASSERT #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT @@ -163,3 +167,5 @@ int main() { CT_ASSERT(std::is_same>{}); } } + +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/test/add_member_volatile.cpp b/test/add_member_volatile.cpp index 3e64509..1862537 100644 --- a/test/add_member_volatile.cpp +++ b/test/add_member_volatile.cpp @@ -13,6 +13,14 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo{}; namespace ct = callable_traits; @@ -21,17 +29,17 @@ int main() { { using f = int(foo::*)(int); - using l = int(foo::*)(int) &; - using r = int(foo::*)(int) &&; + using l = int(foo::*)(int) LREF; + using r = int(foo::*)(int) RREF; using c = int(foo::*)(int) const; - using cl = int(foo::*)(int) const &; - using cr = int(foo::*)(int) const &&; + using cl = int(foo::*)(int) const LREF; + using cr = int(foo::*)(int) const RREF; using v = int(foo::*)(int) volatile; - using vl = int(foo::*)(int) volatile &; - using vr = int(foo::*)(int) volatile &&; + using vl = int(foo::*)(int) volatile LREF; + using vr = int(foo::*)(int) volatile RREF; using cv = int(foo::*)(int) const volatile; - using cvl = int(foo::*)(int) const volatile &; - using cvr = int(foo::*)(int) const volatile &&; + using cvl = int(foo::*)(int) const volatile LREF; + using cvr = int(foo::*)(int) const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -47,19 +55,21 @@ int main() { CT_ASSERT(std::is_same>{}); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = foo(); - using l = foo() &; - using r = foo() &&; + using l = foo() LREF; + using r = foo() RREF; using c = foo() const; - using cl = foo() const &; - using cr = foo() const &&; + using cl = foo() const LREF; + using cr = foo() const RREF; using v = foo() volatile; - using vl = foo() volatile &; - using vr = foo() volatile &&; + using vl = foo() volatile LREF; + using vr = foo() volatile RREF; using cv = foo() const volatile; - using cvl = foo() const volatile &; - using cvr = foo() const volatile &&; + using cvl = foo() const volatile LREF; + using cvr = foo() const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -74,4 +84,6 @@ int main() { CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); } + +#endif } diff --git a/test/add_varargs.cpp b/test/add_varargs.cpp index 0dbca04..fd2ff78 100644 --- a/test/add_varargs.cpp +++ b/test/add_varargs.cpp @@ -13,231 +13,243 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; int main() { - { + { using f = void(foo::*)(); - using l = void(foo::*)() &; - using r = void(foo::*)() && ; + using l = void(foo::*)() LREF; + using r = void(foo::*)() RREF ; using c = void(foo::*)() const; - using cl = void(foo::*)() const &; - using cr = void(foo::*)() const &&; + using cl = void(foo::*)() const LREF; + using cr = void(foo::*)() const RREF; using v = void(foo::*)() volatile; - using vl = void(foo::*)() volatile &; - using vr = void(foo::*)() volatile &&; + using vl = void(foo::*)() volatile LREF; + using vr = void(foo::*)() volatile RREF; using cv = void(foo::*)() const volatile; - using cvl = void(foo::*)() const volatile &; - using cvr = void(foo::*)() const volatile &&; - - using va_f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...); - using va_l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) &; - using va_r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) && ; + using cvl = void(foo::*)() const volatile LREF; + using cvr = void(foo::*)() const volatile RREF; + + using va_f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...); + using va_l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) LREF; + using va_r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) RREF ; using va_c = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const; - using va_cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &; - using va_cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &&; + using va_cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const LREF; + using va_cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const RREF; using va_v = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile; - using va_vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &; - using va_vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &&; + using va_vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile LREF; + using va_vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile RREF; using va_cv = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile; - using va_cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &; - using va_cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &&; - + using va_cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile LREF; + using va_cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile RREF; + CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); } - - { + + { using f = void(foo::* const &)(int&, int&&); - using l = void(foo::* const &)(int&, int&&) &; - using r = void(foo::* const &)(int&, int&&) && ; + using l = void(foo::* const &)(int&, int&&) LREF; + using r = void(foo::* const &)(int&, int&&) RREF ; using c = void(foo::* const &)(int&, int&&) const; - using cl = void(foo::* const &)(int&, int&&) const &; - using cr = void(foo::* const &)(int&, int&&) const &&; + using cl = void(foo::* const &)(int&, int&&) const LREF; + using cr = void(foo::* const &)(int&, int&&) const RREF; using v = void(foo::* const &)(int&, int&&) volatile; - using vl = void(foo::* const &)(int&, int&&) volatile &; - using vr = void(foo::* const &)(int&, int&&) volatile &&; + using vl = void(foo::* const &)(int&, int&&) volatile LREF; + using vr = void(foo::* const &)(int&, int&&) volatile RREF; using cv = void(foo::* const &)(int&, int&&) const volatile; - using cvl = void(foo::* const &)(int&, int&&) const volatile &; - using cvr = void(foo::* const &)(int&, int&&) const volatile &&; - - using va_f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...); - using va_l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) &; - using va_r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) && ; + using cvl = void(foo::* const &)(int&, int&&) const volatile LREF; + using cvr = void(foo::* const &)(int&, int&&) const volatile RREF; + + using va_f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...); + using va_l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) LREF; + using va_r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) RREF ; using va_c = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const; - using va_cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const &; - using va_cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const &&; + using va_cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const LREF; + using va_cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const RREF; using va_v = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile; - using va_vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile &; - using va_vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile &&; + using va_vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile LREF; + using va_vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile RREF; using va_cv = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile; - using va_cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile &; - using va_cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile &&; - + using va_cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile LREF; + using va_cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile RREF; + CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); } - - { + +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF ; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; - - using va_f = void(...); - using va_l = void(...) &; - using va_r = void(...) && ; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; + + using va_f = void(...); + using va_l = void(...) LREF; + using va_r = void(...) RREF ; using va_c = void(...) const; - using va_cl = void(...) const &; - using va_cr = void(...) const &&; + using va_cl = void(...) const LREF; + using va_cr = void(...) const RREF; using va_v = void(...) volatile; - using va_vl = void(...) volatile &; - using va_vr = void(...) volatile &&; + using va_vl = void(...) volatile LREF; + using va_vr = void(...) volatile RREF; using va_cv = void(...) const volatile; - using va_cvl = void(...) const volatile &; - using va_cvr = void(...) const volatile &&; - + using va_cvl = void(...) const volatile LREF; + using va_cvr = void(...) const volatile RREF; + CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); } - - { - using f = void(*)(); - using l = void(* &)(); - using r = void(* &&)(); + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + + { + using f = void(*)(); + using l = void(* LREF)(); + using r = void(* RREF)(); using c = void(* const)(); - using cl = void(* const &)(); - using cr = void(* const &&)(); + using cl = void(* const LREF)(); + using cr = void(* const RREF)(); using v = void(* volatile)(); - using vl = void(* volatile &)(); - using vr = void(* volatile &&)(); + using vl = void(* volatile LREF)(); + using vr = void(* volatile RREF)(); using cv = void(* const volatile)(); - using cvl = void(* const volatile &)(); - using cvr = void(* const volatile &&)(); - - using va_f = void(* )(...); - using va_l = void(* &)(...); - using va_r = void(* &&)(...); + using cvl = void(* const volatile LREF)(); + using cvr = void(* const volatile RREF)(); + + using va_f = void(* )(...); + using va_l = void(* LREF)(...); + using va_r = void(* RREF)(...); using va_c = void(* const)(...); - using va_cl = void(* const &)(...); - using va_cr = void(* const &&)(...); + using va_cl = void(* const LREF)(...); + using va_cr = void(* const RREF)(...); using va_v = void(* volatile)(...); - using va_vl = void(* volatile &)(...); - using va_vr = void(* volatile &&)(...); + using va_vl = void(* volatile LREF)(...); + using va_vr = void(* volatile RREF)(...); using va_cv = void(* const volatile)(...); - using va_cvl = void(* const volatile &)(...); - using va_cvr = void(* const volatile &&)(...); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - } - - { - using f = void(&)(); - using va_f = void(&)(...); - CT_ASSERT(std::is_same>{}); - } + using va_cvl = void(* const volatile LREF)(...); + using va_cvr = void(* const volatile RREF)(...); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + } + + { + using f = void(&)(); + using va_f = void(&)(...); + CT_ASSERT(std::is_same>{}); + } } diff --git a/test/arity.cpp b/test/arity.cpp index 9dea65d..b4117f4 100644 --- a/test/arity.cpp +++ b/test/arity.cpp @@ -64,6 +64,8 @@ struct simple_overloaded_function_object { void operator()(int, int, int, int, int) {} }; +#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + struct overloaded_function_object { void operator()(int) & {} void operator()(int, int) && {} @@ -75,6 +77,8 @@ struct overloaded_function_object { void operator()(int, int, int, int, int, int, int, int) const volatile && {} }; +#endif //#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + void three_arg_function(char&&, float&, int = 0) {} void three_arg_function_with_varargs(char&&, float&, int = 0, ...) {} @@ -93,8 +97,11 @@ template< > void test_arity() { CT_ASSERT(ct::arity() == ExpectedArity); + +#ifndef CALLABLE_TRAITS_DISABLE_ARITY_RANGE CT_ASSERT(ct::min_arity() == ExpectedMinArity); CT_ASSERT(ct::max_arity() == ExpectedMaxArity); +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ARITY_RANGE } template< @@ -109,11 +116,16 @@ void test_arity(T&& t) { using arity_result = decltype(ct::arity(t)); CT_ASSERT(arity_result{} == ExpectedArity); +#ifndef CALLABLE_TRAITS_DISABLE_ARITY_RANGE + using min_arity_result = decltype(ct::min_arity(t)); CT_ASSERT(min_arity_result{} == ExpectedMinArity); using max_arity_result = decltype(ct::max_arity(t)); CT_ASSERT(max_arity_result{} == ExpectedMaxArity); + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ARITY_RANGE + } constexpr const auto limit = ct::constants::arity_search_limit; @@ -134,7 +146,7 @@ int main() { test_arity(); test_arity(); test_arity<3, 3, 3, limit>(&F::operator()); - test_arity<3, 3, 3, limit_plus>(&F::operator()); + test_arity<3, 3, 3, limit_plus>(&F::operator()); test_arity<3, 3, 3, limit_minus>(&F::operator()); } { //testing pmf with varargs @@ -243,7 +255,11 @@ int main() { test_arity<-1, 2, 5, limit>(T{}); test_arity<-1, 2, 5, limit_plus>(T{}); test_arity<-1, 2, 5, limit_minus>(T{}); - } { + } + +#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + + { //testing cv/ref qualified overloads using T = overloaded_function_object; test_arity(); @@ -258,7 +274,11 @@ int main() { test_arity(); test_arity(); #endif + } + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS + { //testing function without varargs using T = decltype(three_arg_function); diff --git a/test/can_invoke.cpp b/test/can_invoke.cpp index a876ef2..eadae80 100644 --- a/test/can_invoke.cpp +++ b/test/can_invoke.cpp @@ -48,8 +48,8 @@ int main() { CT_ASSERT(!decltype(ct::can_invoke(&foo1::bar, foo1{}, 'a', 3.0, 1)){}); CT_ASSERT(decltype(ct::can_invoke(&foo1::bar, std::declval(), 'a', f, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(&foo1::bar, std::declval(), 'a', 3.0, 1)){}); - CT_ASSERT(decltype(ct::can_invoke(&foo1::bar, std::make_unique(), 'a', f, 1)){}); - CT_ASSERT(!decltype(ct::can_invoke(&foo1::bar, std::make_unique(), 'a', 3.0, 1)){}); + CT_ASSERT(decltype(ct::can_invoke(&foo1::bar, std::declval>(), 'a', f, 1)){}); + CT_ASSERT(!decltype(ct::can_invoke(&foo1::bar, std::declval>(), 'a', 3.0, 1)){}); CT_ASSERT(decltype(ct::can_invoke(&foo1::bar, std::ref(foo), 'a', f, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(&foo1::bar, std::ref(foo), 'a', 3.0, 1)){}); } { @@ -60,8 +60,8 @@ int main() { CT_ASSERT(!decltype(ct::can_invoke(&foo2::bar, foo2{}, 'a', 3.0, 1)){}); CT_ASSERT(decltype(ct::can_invoke(&foo2::bar, std::declval(), 'a', f, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(&foo2::bar, std::declval(), 'a', 3.0, 1)){}); - CT_ASSERT(decltype(ct::can_invoke(&foo2::bar, std::make_unique(), 'a', f, 1)){}); - CT_ASSERT(!decltype(ct::can_invoke(&foo2::bar, std::make_unique(), 'a', 3.0, 1)){}); + CT_ASSERT(decltype(ct::can_invoke(&foo2::bar, std::declval>(), 'a', f, 1)){}); + CT_ASSERT(!decltype(ct::can_invoke(&foo2::bar, std::declval>(), 'a', 3.0, 1)){}); CT_ASSERT(decltype(ct::can_invoke(&foo2::bar, std::ref(foo), 'a', f, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(&foo2::bar, std::ref(foo), 'a', 3.0, 1)){}); } { @@ -72,8 +72,8 @@ int main() { CT_ASSERT(!decltype(ct::can_invoke(foo3{}, 'a', 3.0, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(std::declval(), 'a', f, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(std::declval(), 'a', 3.0, 1)){}); - CT_ASSERT(!decltype(ct::can_invoke(std::make_unique(), 'a', f, 1)){}); - CT_ASSERT(!decltype(ct::can_invoke(std::make_unique(), 'a', 3.0, 1)){}); + CT_ASSERT(!decltype(ct::can_invoke(std::declval>(), 'a', f, 1)){}); + CT_ASSERT(!decltype(ct::can_invoke(std::declval>(), 'a', 3.0, 1)){}); CT_ASSERT(decltype(ct::can_invoke(std::ref(foo), 'a', f, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(std::ref(foo), 'a', 3.0, 1)){}); } { @@ -84,8 +84,8 @@ int main() { CT_ASSERT(!decltype(ct::can_invoke(foo4{}, 'a', 3.0, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(std::declval(), 'a', f, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(std::declval(), 'a', 3.0, 1)){}); - CT_ASSERT(!decltype(ct::can_invoke(std::make_unique(), 'a', f, 1)){}); - CT_ASSERT(!decltype(ct::can_invoke(std::make_unique(), 'a', 3.0, 1)){}); + CT_ASSERT(!decltype(ct::can_invoke(std::declval>(), 'a', f, 1)){}); + CT_ASSERT(!decltype(ct::can_invoke(std::declval>(), 'a', 3.0, 1)){}); CT_ASSERT(decltype(ct::can_invoke(std::ref(foo), 'a', f, 1)){}); CT_ASSERT(!decltype(ct::can_invoke(std::ref(foo), 'a', 3.0, 1)){}); } { diff --git a/test/can_invoke_libcxx.cpp b/test/can_invoke_libcxx.cpp index e72b112..ca4f5ac 100644 --- a/test/can_invoke_libcxx.cpp +++ b/test/can_invoke_libcxx.cpp @@ -46,6 +46,9 @@ #include #include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else #ifndef CT_ASSERT #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) @@ -249,4 +252,6 @@ int main() { bullet_one_two_tests(); bullet_three_four_tests(); bullet_five_tests(); -} \ No newline at end of file +} + +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/test/has_member_qualifiers.cpp b/test/has_member_qualifiers.cpp index 0b83769..ffc4333 100644 --- a/test/has_member_qualifiers.cpp +++ b/test/has_member_qualifiers.cpp @@ -13,6 +13,10 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main() { return 0; } +#else + struct foo {}; namespace ct = callable_traits; @@ -130,6 +134,8 @@ int main() { assert_qualified(); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = void(); using l = void() &; @@ -158,9 +164,13 @@ int main() { CT_ASSERT(ct::has_member_qualifiers()); } - using f_ptr = void(*)(); +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + + using f_ptr = void(*)(); assert_unqualified(); - assert_unqualified(); - assert_unqualified(); - assert_unqualified(); + assert_unqualified(); + assert_unqualified(); + assert_unqualified(); } + +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/test/has_member_qualifiers_simple.cpp b/test/has_member_qualifiers_simple.cpp new file mode 100644 index 0000000..3656281 --- /dev/null +++ b/test/has_member_qualifiers_simple.cpp @@ -0,0 +1,107 @@ +/* +Copyright Barrett Adair 2016 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) +*/ + +#include +#include +#include +#include + +#ifndef CT_ASSERT +#define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) +#endif //CT_ASSERT + + +struct foo {}; + +namespace ct = callable_traits; + +template +void assert_qualified() { + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + CT_ASSERT(ct::has_member_qualifiers()); + + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(decltype(ct::has_member_qualifiers(std::declval()))::value); +} + + +template +void assert_unqualified() { + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + CT_ASSERT(!ct::has_member_qualifiers()); + + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); + CT_ASSERT(!decltype(ct::has_member_qualifiers(std::declval()))::value); +} + +int main() { + + { + using f = void(foo::*)(); + using c = void(foo::*)() const; + using v = void(foo::*)() volatile; + using cv = void(foo::*)() const volatile; + + assert_unqualified(); + assert_qualified(); + assert_qualified(); + assert_qualified(); + } + + { + struct f { int operator()() { return 0; } }; + struct c { int operator()() const { return 0; } }; + struct v { int operator()() volatile { return 0; } }; + struct cv { int operator()() const volatile { return 0; } }; + + assert_unqualified(); + assert_qualified(); + assert_qualified(); + assert_qualified(); + } + + using f_ptr = void(*)(); + assert_unqualified(); + assert_unqualified(); + assert_unqualified(); + assert_unqualified(); +} diff --git a/test/has_varargs.cpp b/test/has_varargs.cpp index c804360..44f0e3e 100644 --- a/test/has_varargs.cpp +++ b/test/has_varargs.cpp @@ -13,13 +13,21 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; template void assert_has_varargs() { - + CT_ASSERT(ct::has_varargs()); CT_ASSERT(ct::has_varargs()); CT_ASSERT(ct::has_varargs()); @@ -48,7 +56,7 @@ void assert_has_varargs() { template void assert_not_has_varargs() { - + CT_ASSERT(!ct::has_varargs()); CT_ASSERT(!ct::has_varargs()); CT_ASSERT(!ct::has_varargs()); @@ -74,21 +82,22 @@ void assert_not_has_varargs() { CT_ASSERT(!decltype(ct::has_varargs(std::declval()))::value); } + int main() { { using f = void(foo::*)(); - using l = void(foo::*)() &; - using r = void(foo::*)() && ; + using l = void(foo::*)() LREF; + using r = void(foo::*)() RREF ; using c = void(foo::*)() const; - using cl = void(foo::*)() const &; - using cr = void(foo::*)() const &&; + using cl = void(foo::*)() const LREF; + using cr = void(foo::*)() const RREF; using v = void(foo::*)() volatile; - using vl = void(foo::*)() volatile &; - using vr = void(foo::*)() volatile &&; + using vl = void(foo::*)() volatile LREF; + using vr = void(foo::*)() volatile RREF; using cv = void(foo::*)() const volatile; - using cvl = void(foo::*)() const volatile &; - using cvr = void(foo::*)() const volatile &&; + using cvl = void(foo::*)() const volatile LREF; + using cvr = void(foo::*)() const volatile RREF; assert_not_has_varargs(); assert_not_has_varargs(); @@ -104,19 +113,19 @@ int main() { assert_not_has_varargs(); } - { + { using f = int foo::*; - using l = int foo::* &; - using r = int foo::* && ; + using l = int foo::* LREF; + using r = int foo::* RREF ; using c = int foo::* const; - using cl = int foo::* const &; - using cr = int foo::* const &&; + using cl = int foo::* const LREF; + using cr = int foo::* const RREF; using v = int foo::* volatile; - using vl = int foo::* volatile &; - using vr = int foo::* volatile &&; + using vl = int foo::* volatile LREF; + using vr = int foo::* volatile RREF; using cv = int foo::* const volatile; - using cvl = int foo::* const volatile &; - using cvr = int foo::* const volatile &&; + using cvl = int foo::* const volatile LREF; + using cvr = int foo::* const volatile RREF; assert_not_has_varargs(); assert_not_has_varargs(); @@ -131,12 +140,12 @@ int main() { assert_not_has_varargs(); assert_not_has_varargs(); } - - { - //a member data pointer to a function pointer - //is not treated like a member function pointer - using f_ptr = void(*)(...); - + + { + //a member data pointer to a function pointer + //is not treated like a member function pointer + using f_ptr = void(*)(...); + using f = f_ptr foo::*; using l = f_ptr foo::* &; using r = f_ptr foo::* && ; @@ -163,20 +172,20 @@ int main() { assert_not_has_varargs(); assert_not_has_varargs(); } - - { + + { using f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...); - using l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) &; - using r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) && ; + using l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) LREF; + using r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) RREF ; using c = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const; - using cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &; - using cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &&; + using cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const LREF; + using cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const RREF; using v = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile; - using vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &; - using vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &&; + using vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile LREF; + using vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile RREF; using cv = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile; - using cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &; - using cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &&; + using cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile LREF; + using cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile RREF; assert_has_varargs(); assert_has_varargs(); @@ -191,20 +200,20 @@ int main() { assert_has_varargs(); assert_has_varargs(); } - + { struct f { int operator()() { return 0; } }; - struct l { int operator()() & { return 0; } }; - struct r { int operator()() && { return 0; } }; + struct l { int operator()() LREF { return 0; } }; + struct r { int operator()() RREF { return 0; } }; struct c { int operator()() const { return 0; } }; - struct cl { int operator()() const & { return 0; } }; - struct cr { int operator()() const && { return 0; } }; + struct cl { int operator()() const LREF { return 0; } }; + struct cr { int operator()() const RREF { return 0; } }; struct v { int operator()() volatile { return 0; } }; - struct vl { int operator()() volatile & { return 0; } }; - struct vr { int operator()() volatile && { return 0; } }; + struct vl { int operator()() volatile LREF { return 0; } }; + struct vr { int operator()() volatile RREF { return 0; } }; struct cv { int operator()() const volatile { return 0; } }; - struct cvl { int operator()() const volatile & { return 0; } }; - struct cvr { int operator()() const volatile && { return 0; } }; + struct cvl { int operator()() const volatile LREF { return 0; } }; + struct cvr { int operator()() const volatile RREF { return 0; } }; assert_not_has_varargs(); assert_not_has_varargs(); @@ -220,19 +229,19 @@ int main() { assert_not_has_varargs(); } - { + { struct f { int operator()(...) { return 0; } }; - struct l { int operator()(...) & { return 0; } }; - struct r { int operator()(...) && { return 0; } }; + struct l { int operator()(...) LREF { return 0; } }; + struct r { int operator()(...) RREF { return 0; } }; struct c { int operator()(...) const { return 0; } }; - struct cl { int operator()(...) const & { return 0; } }; - struct cr { int operator()(...) const && { return 0; } }; + struct cl { int operator()(...) const LREF { return 0; } }; + struct cr { int operator()(...) const RREF { return 0; } }; struct v { int operator()(...) volatile { return 0; } }; - struct vl { int operator()(...) volatile & { return 0; } }; - struct vr { int operator()(...) volatile && { return 0; } }; + struct vl { int operator()(...) volatile LREF { return 0; } }; + struct vr { int operator()(...) volatile RREF { return 0; } }; struct cv { int operator()(...) const volatile { return 0; } }; - struct cvl { int operator()(...) const volatile & { return 0; } }; - struct cvr { int operator()(...) const volatile && { return 0; } }; + struct cvl { int operator()(...) const volatile LREF { return 0; } }; + struct cvr { int operator()(...) const volatile RREF { return 0; } }; assert_has_varargs(); assert_has_varargs(); @@ -247,20 +256,22 @@ int main() { assert_has_varargs(); assert_has_varargs(); } - + +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF ; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; CT_ASSERT(!ct::has_varargs()); CT_ASSERT(!ct::has_varargs()); @@ -276,19 +287,19 @@ int main() { CT_ASSERT(!ct::has_varargs()); } - { + { using f = void(...); - using l = void(...) &; - using r = void(...) && ; + using l = void(...) LREF; + using r = void(...) RREF ; using c = void(...) const; - using cl = void(...) const &; - using cr = void(...) const &&; + using cl = void(...) const LREF; + using cr = void(...) const RREF; using v = void(...) volatile; - using vl = void(...) volatile &; - using vr = void(...) volatile &&; + using vl = void(...) volatile LREF; + using vr = void(...) volatile RREF; using cv = void(...) const volatile; - using cvl = void(...) const volatile &; - using cvr = void(...) const volatile &&; + using cvl = void(...) const volatile LREF; + using cvr = void(...) const volatile RREF; CT_ASSERT(ct::has_varargs()); CT_ASSERT(ct::has_varargs()); @@ -303,9 +314,11 @@ int main() { CT_ASSERT(ct::has_varargs()); CT_ASSERT(ct::has_varargs()); } - - assert_not_has_varargs(); - assert_has_varargs(); - assert_not_has_varargs(); - assert_has_varargs(); + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + + assert_not_has_varargs(); + assert_has_varargs(); + assert_not_has_varargs(); + assert_has_varargs(); } diff --git a/test/is_const_member.cpp b/test/is_const_member.cpp index c994d25..a1e3a24 100644 --- a/test/is_const_member.cpp +++ b/test/is_const_member.cpp @@ -13,6 +13,14 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; @@ -76,17 +84,17 @@ int main() { { using f = void(foo::*)(); - using l = void(foo::*)() &; - using r = void(foo::*)() && ; + using l = void(foo::*)() LREF; + using r = void(foo::*)() RREF ; using c = void(foo::*)() const; - using cl = void(foo::*)() const &; - using cr = void(foo::*)() const &&; + using cl = void(foo::*)() const LREF; + using cr = void(foo::*)() const RREF; using v = void(foo::*)() volatile; - using vl = void(foo::*)() volatile &; - using vr = void(foo::*)() volatile &&; + using vl = void(foo::*)() volatile LREF; + using vr = void(foo::*)() volatile RREF; using cv = void(foo::*)() const volatile; - using cvl = void(foo::*)() const volatile &; - using cvr = void(foo::*)() const volatile &&; + using cvl = void(foo::*)() const volatile LREF; + using cvr = void(foo::*)() const volatile RREF; assert_not_const_qualified(); assert_not_const_qualified(); @@ -104,17 +112,17 @@ int main() { { struct f { int operator()() { return 0; } }; - struct l { int operator()() & { return 0; } }; - struct r { int operator()() && { return 0; } }; + struct l { int operator()() LREF { return 0; } }; + struct r { int operator()() RREF { return 0; } }; struct c { int operator()() const { return 0; } }; - struct cl { int operator()() const & { return 0; } }; - struct cr { int operator()() const && { return 0; } }; + struct cl { int operator()() const LREF { return 0; } }; + struct cr { int operator()() const RREF { return 0; } }; struct v { int operator()() volatile { return 0; } }; - struct vl { int operator()() volatile & { return 0; } }; - struct vr { int operator()() volatile && { return 0; } }; + struct vl { int operator()() volatile LREF { return 0; } }; + struct vr { int operator()() volatile RREF { return 0; } }; struct cv { int operator()() const volatile { return 0; } }; - struct cvl { int operator()() const volatile & { return 0; } }; - struct cvr { int operator()() const volatile && { return 0; } }; + struct cvl { int operator()() const volatile LREF { return 0; } }; + struct cvr { int operator()() const volatile RREF { return 0; } }; assert_not_const_qualified(); assert_not_const_qualified(); @@ -130,19 +138,21 @@ int main() { assert_const_qualified(); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF ; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; CT_ASSERT(!ct::is_const_member()); CT_ASSERT(!ct::is_const_member()); @@ -158,9 +168,11 @@ int main() { CT_ASSERT(ct::is_const_member()); } - using f_ptr = void(*)(); +#endif + + using f_ptr = void(*)(); assert_not_const_qualified(); - assert_not_const_qualified(); - assert_not_const_qualified(); - assert_not_const_qualified(); + assert_not_const_qualified(); + assert_not_const_qualified(); + assert_not_const_qualified(); } diff --git a/test/is_cv_member.cpp b/test/is_cv_member.cpp index d49cffa..132168e 100644 --- a/test/is_cv_member.cpp +++ b/test/is_cv_member.cpp @@ -13,6 +13,14 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; @@ -76,17 +84,17 @@ int main() { { using f = void(foo::*)(); - using l = void(foo::*)() &; - using r = void(foo::*)() && ; + using l = void(foo::*)() LREF; + using r = void(foo::*)() RREF ; using c = void(foo::*)() const; - using cl = void(foo::*)() const &; - using cr = void(foo::*)() const &&; + using cl = void(foo::*)() const LREF; + using cr = void(foo::*)() const RREF; using v = void(foo::*)() volatile; - using vl = void(foo::*)() volatile &; - using vr = void(foo::*)() volatile &&; + using vl = void(foo::*)() volatile LREF; + using vr = void(foo::*)() volatile RREF; using cv = void(foo::*)() const volatile; - using cvl = void(foo::*)() const volatile &; - using cvr = void(foo::*)() const volatile &&; + using cvl = void(foo::*)() const volatile LREF; + using cvr = void(foo::*)() const volatile RREF; assert_not_cv_qualified(); assert_not_cv_qualified(); @@ -104,17 +112,17 @@ int main() { { struct f { int operator()() { return 0; } }; - struct l { int operator()() & { return 0; } }; - struct r { int operator()() && { return 0; } }; + struct l { int operator()() LREF { return 0; } }; + struct r { int operator()() RREF { return 0; } }; struct c { int operator()() const { return 0; } }; - struct cl { int operator()() const & { return 0; } }; - struct cr { int operator()() const && { return 0; } }; + struct cl { int operator()() const LREF { return 0; } }; + struct cr { int operator()() const RREF { return 0; } }; struct v { int operator()() volatile { return 0; } }; - struct vl { int operator()() volatile & { return 0; } }; - struct vr { int operator()() volatile && { return 0; } }; + struct vl { int operator()() volatile LREF { return 0; } }; + struct vr { int operator()() volatile RREF { return 0; } }; struct cv { int operator()() const volatile { return 0; } }; - struct cvl { int operator()() const volatile & { return 0; } }; - struct cvr { int operator()() const volatile && { return 0; } }; + struct cvl { int operator()() const volatile LREF { return 0; } }; + struct cvr { int operator()() const volatile RREF { return 0; } }; assert_not_cv_qualified(); assert_not_cv_qualified(); @@ -130,19 +138,21 @@ int main() { assert_cv_qualified(); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF ; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; CT_ASSERT(!ct::is_cv_member()); CT_ASSERT(!ct::is_cv_member()); @@ -158,6 +168,8 @@ int main() { CT_ASSERT(ct::is_cv_member()); } +#endif + using f_ptr = void(*)(); assert_not_cv_qualified(); assert_not_cv_qualified(); diff --git a/test/is_lvalue_reference_member.cpp b/test/is_lvalue_reference_member.cpp index 697f861..2968343 100644 --- a/test/is_lvalue_reference_member.cpp +++ b/test/is_lvalue_reference_member.cpp @@ -13,6 +13,10 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + struct foo {}; namespace ct = callable_traits; @@ -166,3 +170,5 @@ int main() { assert_not_lvalue_qualified(); assert_not_lvalue_qualified(); } + +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/test/is_rvalue_reference_member.cpp b/test/is_rvalue_reference_member.cpp index d4d5546..5967e58 100644 --- a/test/is_rvalue_reference_member.cpp +++ b/test/is_rvalue_reference_member.cpp @@ -13,6 +13,10 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + struct foo {}; namespace ct = callable_traits; @@ -166,3 +170,5 @@ int main() { assert_not_rvalue_qualified(); assert_not_rvalue_qualified(); } + +#endif //#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/test/is_volatile_member.cpp b/test/is_volatile_member.cpp index 3e77e64..cbb8500 100644 --- a/test/is_volatile_member.cpp +++ b/test/is_volatile_member.cpp @@ -13,6 +13,14 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; @@ -21,7 +29,7 @@ template void assert_volatile_qualified() { CT_ASSERT(ct::is_volatile_member()); CT_ASSERT(ct::is_volatile_member()); - CT_ASSERT(ct::is_volatile_member()); + CT_ASSERT(ct::is_volatile_member()); CT_ASSERT(ct::is_volatile_member()); CT_ASSERT(ct::is_volatile_member()); CT_ASSERT(ct::is_volatile_member()); @@ -32,7 +40,7 @@ void assert_volatile_qualified() { CT_ASSERT(ct::is_volatile_member()); CT_ASSERT(decltype(ct::is_volatile_member(std::declval()))::value); - CT_ASSERT(decltype(ct::is_volatile_member(std::declval()))::value); + CT_ASSERT(decltype(ct::is_volatile_member(std::declval()))::value); CT_ASSERT(decltype(ct::is_volatile_member(std::declval()))::value); CT_ASSERT(decltype(ct::is_volatile_member(std::declval()))::value); CT_ASSERT(decltype(ct::is_volatile_member(std::declval()))::value); @@ -63,7 +71,7 @@ void assert_not_volatile_qualified() { CT_ASSERT(!decltype(ct::is_volatile_member(std::declval()))::value); CT_ASSERT(!decltype(ct::is_volatile_member(std::declval()))::value); CT_ASSERT(!decltype(ct::is_volatile_member(std::declval()))::value); - CT_ASSERT(!decltype(ct::is_volatile_member(std::declval()))::value); + CT_ASSERT(!decltype(ct::is_volatile_member(std::declval()))::value); CT_ASSERT(!decltype(ct::is_volatile_member(std::declval()))::value); CT_ASSERT(!decltype(ct::is_volatile_member(std::declval()))::value); CT_ASSERT(!decltype(ct::is_volatile_member(std::declval()))::value); @@ -76,17 +84,17 @@ int main() { { using f = void(foo::*)(); - using l = void(foo::*)() &; - using r = void(foo::*)() && ; + using l = void(foo::*)() LREF; + using r = void(foo::*)() RREF ; using c = void(foo::*)() const; - using cl = void(foo::*)() const &; - using cr = void(foo::*)() const &&; + using cl = void(foo::*)() const LREF; + using cr = void(foo::*)() const RREF; using v = void(foo::*)() volatile; - using vl = void(foo::*)() volatile &; - using vr = void(foo::*)() volatile &&; + using vl = void(foo::*)() volatile LREF; + using vr = void(foo::*)() volatile RREF; using cv = void(foo::*)() const volatile; - using cvl = void(foo::*)() const volatile &; - using cvr = void(foo::*)() const volatile &&; + using cvl = void(foo::*)() const volatile LREF; + using cvr = void(foo::*)() const volatile RREF; assert_not_volatile_qualified(); assert_not_volatile_qualified(); @@ -104,17 +112,17 @@ int main() { { struct f { int operator()() { return 0; } }; - struct l { int operator()() & { return 0; } }; - struct r { int operator()() && { return 0; } }; + struct l { int operator()() LREF { return 0; } }; + struct r { int operator()() RREF { return 0; } }; struct c { int operator()() const { return 0; } }; - struct cl { int operator()() const & { return 0; } }; - struct cr { int operator()() const && { return 0; } }; + struct cl { int operator()() const LREF { return 0; } }; + struct cr { int operator()() const RREF { return 0; } }; struct v { int operator()() volatile { return 0; } }; - struct vl { int operator()() volatile & { return 0; } }; - struct vr { int operator()() volatile && { return 0; } }; + struct vl { int operator()() volatile LREF { return 0; } }; + struct vr { int operator()() volatile RREF { return 0; } }; struct cv { int operator()() const volatile { return 0; } }; - struct cvl { int operator()() const volatile & { return 0; } }; - struct cvr { int operator()() const volatile && { return 0; } }; + struct cvl { int operator()() const volatile LREF { return 0; } }; + struct cvr { int operator()() const volatile RREF { return 0; } }; assert_not_volatile_qualified(); assert_not_volatile_qualified(); @@ -130,19 +138,21 @@ int main() { assert_volatile_qualified(); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF ; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; CT_ASSERT(!ct::is_volatile_member()); CT_ASSERT(!ct::is_volatile_member()); @@ -158,9 +168,11 @@ int main() { CT_ASSERT(ct::is_volatile_member()); } +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + using f_ptr = void(*)(); assert_not_volatile_qualified(); assert_not_volatile_qualified(); assert_not_volatile_qualified(); - assert_not_volatile_qualified(); + assert_not_volatile_qualified(); } diff --git a/test/remove_member_const.cpp b/test/remove_member_const.cpp index fdd11fb..915e6a7 100644 --- a/test/remove_member_const.cpp +++ b/test/remove_member_const.cpp @@ -13,6 +13,14 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; @@ -21,17 +29,17 @@ int main() { { using f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...); - using l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) &; - using r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) && ; + using l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) LREF; + using r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) RREF ; using c = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const; - using cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &; - using cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &&; + using cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const LREF; + using cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const RREF; using v = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile; - using vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &; - using vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &&; + using vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile LREF; + using vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile RREF; using cv = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile; - using cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &; - using cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &&; + using cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile LREF; + using cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -49,17 +57,17 @@ int main() { { using f = foo const & (foo::* const volatile &)(int, int); - using l = foo const & (foo::* const volatile &)(int, int) &; - using r = foo const & (foo::* const volatile &)(int, int) && ; + using l = foo const & (foo::* const volatile &)(int, int) LREF; + using r = foo const & (foo::* const volatile &)(int, int) RREF ; using c = foo const & (foo::* const volatile &)(int, int) const; - using cl = foo const & (foo::* const volatile &)(int, int) const &; - using cr = foo const & (foo::* const volatile &)(int, int) const &&; + using cl = foo const & (foo::* const volatile &)(int, int) const LREF; + using cr = foo const & (foo::* const volatile &)(int, int) const RREF; using v = foo const & (foo::* const volatile &)(int, int) volatile; - using vl = foo const & (foo::* const volatile &)(int, int) volatile &; - using vr = foo const & (foo::* const volatile &)(int, int) volatile &&; + using vl = foo const & (foo::* const volatile &)(int, int) volatile LREF; + using vr = foo const & (foo::* const volatile &)(int, int) volatile RREF; using cv = foo const & (foo::* const volatile &)(int, int) const volatile; - using cvl = foo const & (foo::* const volatile &)(int, int) const volatile &; - using cvr = foo const & (foo::* const volatile &)(int, int) const volatile &&; + using cvl = foo const & (foo::* const volatile &)(int, int) const volatile LREF; + using cvr = foo const & (foo::* const volatile &)(int, int) const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -75,19 +83,21 @@ int main() { CT_ASSERT(std::is_same>{}); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF ; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -102,4 +112,6 @@ int main() { CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); } + +#endif } diff --git a/test/remove_member_reference.cpp b/test/remove_member_reference.cpp index 31a79b5..cd5bfbf 100644 --- a/test/remove_member_reference.cpp +++ b/test/remove_member_reference.cpp @@ -9,6 +9,10 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +int main(){ return 0; } +#else + #ifndef CT_ASSERT #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT @@ -73,8 +77,8 @@ int main() { CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); } - - { + + { using f = void(foo::* const)(); using l = void(foo::* const)() &; using r = void(foo::* const)() &&; @@ -101,7 +105,7 @@ int main() { CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); } - + { using f = void(); using l = void() &; @@ -130,3 +134,5 @@ int main() { CT_ASSERT(std::is_same>{}); } } + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS diff --git a/test/remove_member_volatile.cpp b/test/remove_member_volatile.cpp index 35bdf52..a1e8a38 100644 --- a/test/remove_member_volatile.cpp +++ b/test/remove_member_volatile.cpp @@ -13,6 +13,14 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo{}; namespace ct = callable_traits; @@ -21,22 +29,22 @@ int main() { { using f = char(foo::*)(foo*, int); - using l = char(foo::*)(foo*, int) &; - using r = char(foo::*)(foo*, int) &&; + using l = char(foo::*)(foo*, int) LREF; + using r = char(foo::*)(foo*, int) RREF; using c = char(foo::*)(foo*, int) const; - using cl = char(foo::*)(foo*, int) const &; - using cr = char(foo::*)(foo*, int) const &&; + using cl = char(foo::*)(foo*, int) const LREF; + using cr = char(foo::*)(foo*, int) const RREF; using v = char(foo::*)(foo*, int) volatile; - using vl = char(foo::*)(foo*, int) volatile &; - using vr = char(foo::*)(foo*, int) volatile &&; + using vl = char(foo::*)(foo*, int) volatile LREF; + using vr = char(foo::*)(foo*, int) volatile RREF; using cv = char(foo::*)(foo*, int) const volatile; - using cvl = char(foo::*)(foo*, int) const volatile &; - using cvr = char(foo::*)(foo*, int) const volatile &&; + using cvl = char(foo::*)(foo*, int) const volatile LREF; + using cvr = char(foo::*)(foo*, int) const volatile RREF; - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -47,24 +55,26 @@ int main() { CT_ASSERT(std::is_same>{}); } +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + { using f = foo&&(); - using l = foo&&() &; - using r = foo&&() &&; + using l = foo&&() LREF; + using r = foo&&() RREF; using c = foo&&() const; - using cl = foo&&() const &; - using cr = foo&&() const &&; + using cl = foo&&() const LREF; + using cr = foo&&() const RREF; using v = foo&&() volatile; - using vl = foo&&() volatile &; - using vr = foo&&() volatile &&; + using vl = foo&&() volatile LREF; + using vr = foo&&() volatile RREF; using cv = foo&&() const volatile; - using cvl = foo&&() const volatile &; - using cvr = foo&&() const volatile &&; + using cvl = foo&&() const volatile LREF; + using cvr = foo&&() const volatile RREF; CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); @@ -74,4 +84,7 @@ int main() { CT_ASSERT(std::is_same>{}); CT_ASSERT(std::is_same>{}); } + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + } diff --git a/test/remove_varargs.cpp b/test/remove_varargs.cpp index 6545d12..47e0fdd 100644 --- a/test/remove_varargs.cpp +++ b/test/remove_varargs.cpp @@ -13,177 +13,189 @@ Distributed under the Boost Software License, Version 1.0. #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT +#ifdef CALLABLE_TRAITS_DISABLE_REFERENCE_QUALIFIERS +#define LREF +#define RREF +#else +#define LREF & +#define RREF && +#endif + struct foo {}; namespace ct = callable_traits; int main() { - { + { using f = void(foo::*)(); - using l = void(foo::*)() &; - using r = void(foo::*)() && ; + using l = void(foo::*)() LREF; + using r = void(foo::*)() RREF ; using c = void(foo::*)() const; - using cl = void(foo::*)() const &; - using cr = void(foo::*)() const &&; + using cl = void(foo::*)() const LREF; + using cr = void(foo::*)() const RREF; using v = void(foo::*)() volatile; - using vl = void(foo::*)() volatile &; - using vr = void(foo::*)() volatile &&; + using vl = void(foo::*)() volatile LREF; + using vr = void(foo::*)() volatile RREF; using cv = void(foo::*)() const volatile; - using cvl = void(foo::*)() const volatile &; - using cvr = void(foo::*)() const volatile &&; - - using va_f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...); - using va_l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) &; - using va_r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) && ; + using cvl = void(foo::*)() const volatile LREF; + using cvr = void(foo::*)() const volatile RREF; + + using va_f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...); + using va_l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) LREF; + using va_r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) RREF ; using va_c = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const; - using va_cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &; - using va_cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const &&; + using va_cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const LREF; + using va_cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const RREF; using va_v = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile; - using va_vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &; - using va_vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile &&; + using va_vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile LREF; + using va_vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) volatile RREF; using va_cv = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile; - using va_cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &; - using va_cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile &&; - + using va_cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile LREF; + using va_cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::*)(...) const volatile RREF; + CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); } - - { + + { using f = void(foo::* const &)(int&, int&&); - using l = void(foo::* const &)(int&, int&&) &; - using r = void(foo::* const &)(int&, int&&) && ; + using l = void(foo::* const &)(int&, int&&) LREF; + using r = void(foo::* const &)(int&, int&&) RREF ; using c = void(foo::* const &)(int&, int&&) const; - using cl = void(foo::* const &)(int&, int&&) const &; - using cr = void(foo::* const &)(int&, int&&) const &&; + using cl = void(foo::* const &)(int&, int&&) const LREF; + using cr = void(foo::* const &)(int&, int&&) const RREF; using v = void(foo::* const &)(int&, int&&) volatile; - using vl = void(foo::* const &)(int&, int&&) volatile &; - using vr = void(foo::* const &)(int&, int&&) volatile &&; + using vl = void(foo::* const &)(int&, int&&) volatile LREF; + using vr = void(foo::* const &)(int&, int&&) volatile RREF; using cv = void(foo::* const &)(int&, int&&) const volatile; - using cvl = void(foo::* const &)(int&, int&&) const volatile &; - using cvr = void(foo::* const &)(int&, int&&) const volatile &&; - - using va_f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...); - using va_l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) &; - using va_r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) && ; + using cvl = void(foo::* const &)(int&, int&&) const volatile LREF; + using cvr = void(foo::* const &)(int&, int&&) const volatile RREF; + + using va_f = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...); + using va_l = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) LREF; + using va_r = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) RREF ; using va_c = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const; - using va_cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const &; - using va_cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const &&; + using va_cl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const LREF; + using va_cr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const RREF; using va_v = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile; - using va_vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile &; - using va_vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile &&; + using va_vl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile LREF; + using va_vr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) volatile RREF; using va_cv = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile; - using va_cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile &; - using va_cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile &&; - + using va_cvl = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile LREF; + using va_cvr = void(CALLABLE_TRAITS_DEFAULT_VARARGS_CC foo::* const &)(int&, int&&, ...) const volatile RREF; + CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); } - - { + +#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + + { using f = void(); - using l = void() &; - using r = void() && ; + using l = void() LREF; + using r = void() RREF ; using c = void() const; - using cl = void() const &; - using cr = void() const &&; + using cl = void() const LREF; + using cr = void() const RREF; using v = void() volatile; - using vl = void() volatile &; - using vr = void() volatile &&; + using vl = void() volatile LREF; + using vr = void() volatile RREF; using cv = void() const volatile; - using cvl = void() const volatile &; - using cvr = void() const volatile &&; - - using va_f = void(...); - using va_l = void(...) &; - using va_r = void(...) && ; + using cvl = void() const volatile LREF; + using cvr = void() const volatile RREF; + + using va_f = void(...); + using va_l = void(...) LREF; + using va_r = void(...) RREF ; using va_c = void(...) const; - using va_cl = void(...) const &; - using va_cr = void(...) const &&; + using va_cl = void(...) const LREF; + using va_cr = void(...) const RREF; using va_v = void(...) volatile; - using va_vl = void(...) volatile &; - using va_vr = void(...) volatile &&; + using va_vl = void(...) volatile LREF; + using va_vr = void(...) volatile RREF; using va_cv = void(...) const volatile; - using va_cvl = void(...) const volatile &; - using va_cvr = void(...) const volatile &&; - + using va_cvl = void(...) const volatile LREF; + using va_cvr = void(...) const volatile RREF; + CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); } - - { - using f = void(*)(); - using l = void(* &)(); + +#endif //#ifndef CALLABLE_TRAITS_DISABLE_ABOMINABLE_FUNCTIONS + + { + using f = void(*)(); + using l = void(* &)(); using r = void(* &&)(); using c = void(* const)(); using cl = void(* const &)(); @@ -194,9 +206,9 @@ int main() { using cv = void(* const volatile)(); using cvl = void(* const volatile &)(); using cvr = void(* const volatile &&)(); - - using va_f = void(* )(...); - using va_l = void(* &)(...); + + using va_f = void(* )(...); + using va_l = void(* &)(...); using va_r = void(* &&)(...); using va_c = void(* const)(...); using va_cl = void(* const &)(...); @@ -207,37 +219,37 @@ int main() { using va_cv = void(* const volatile)(...); using va_cvl = void(* const volatile &)(...); using va_cvr = void(* const volatile &&)(...); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - CT_ASSERT(std::is_same>{}); - } - - { - using f = void(&)(); - using va_f = void(&)(...); - CT_ASSERT(std::is_same>{}); - } + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + CT_ASSERT(std::is_same>{}); + } + + { + using f = void(&)(); + using va_f = void(&)(...); + CT_ASSERT(std::is_same>{}); + } }