diff --git a/example/bind_expr/example1.cpp b/example/bind_expr/example1.cpp index ce01a7e..7c9d979 100644 --- a/example/bind_expr/example1.cpp +++ b/example/bind_expr/example1.cpp @@ -78,11 +78,11 @@ int main() { using bind_args = ct::args; using expected_args = std::tuple; - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); using bind_signature = ct::signature; using expected_signature = int(VampireRobotPoodle, Poodle, Vampire); - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); assert(bind_obj(VampireRobotPoodle{}, Poodle{}, Vampire{}) == 0); diff --git a/example/bind_expr/example2.cpp b/example/bind_expr/example2.cpp index eb5b09e..6e753ec 100644 --- a/example/bind_expr/example2.cpp +++ b/example/bind_expr/example2.cpp @@ -49,11 +49,11 @@ int main() { using bind_args = ct::args; using expected_args = std::tuple; - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); using bind_signature = ct::signature; using expected_signature = int(const VampireRobotPoodle&); - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); VampireRobotPoodle vampire_robot_poodle; assert(bind_obj(vampire_robot_poodle) == 0); diff --git a/example/can_invoke_constexpr/function_object.cpp b/example/can_invoke_constexpr/function_object.cpp index 0ca2551..9f04940 100644 --- a/example/can_invoke_constexpr/function_object.cpp +++ b/example/can_invoke_constexpr/function_object.cpp @@ -61,7 +61,7 @@ static_assert(!ct::can_invoke_constexpr(add{}, 3, 7), ""); struct S { S() = delete; S(int){}; - constexpr int operator()() { return 0; } + constexpr int operator()() const { return 0; } }; S s{0}; diff --git a/example/intro.cpp b/example/intro.cpp index 741a654..be32ff2 100644 --- a/example/intro.cpp +++ b/example/intro.cpp @@ -31,22 +31,22 @@ int main() { // indexed argument types using second_arg = ct::arg_at<1, foo>; - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); // arg types are packaged into std::tuple, which serves as the default // type list in CallableTraits (runtime capabilities are not used). using args = ct::args; using expected_args = std::tuple; - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); //callable_traits::result_of is a bit friendlier than std::result_of using return_type = ct::result_of; - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); // callable_traits::signature yields a plain function type using signature = ct::signature; using expected_signature = void(int, int&&, const int&, void*); - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); // when trait information can be conveyed in an integral_constant, // callable_traits uses constexpr functions instead of template aliases. @@ -109,10 +109,11 @@ int main() { static_assert(std::is_same< ct::args, std::tuple - >{}, ""); + >::value, ""); // callable_traits can facilitate the construction of std::function objects. - auto fn = std::function>{ bind_obj }; + using bind_signature = ct::signature; + auto fn = std::function{ bind_obj }; fn(0); // For function objects, the following checks are determined by the @@ -138,21 +139,21 @@ int main() { { // So that you don't have to scroll back up to see, here's the type of pmf: using expected_pmf = void (foo::*)(int, int&&, const int&, void*) const; - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); } { // Let's remove the const qualifier: using mutable_pmf = ct::remove_const_qualifier; using expected_pmf = void (foo::*)(int, int&&, const int&, void*) /*no const!*/; - static_assert(std::is_same{}, ""); + static_assert(std::is_same::value, ""); } { // Now let's add an rvalue qualifier (&&): using rvalue_pmf = ct::add_rvalue_qualifier; using expected_pmf = void (foo::*)(int, int&&, const int&, void*) const &&; - static_assert(std::is_same{}, ""); // ^^^^ + static_assert(std::is_same::value, ""); // ^^^^ } // You get the picture. CallableTraits lets you add and remove all PMF @@ -169,7 +170,7 @@ int main() { using varargs_pmf = ct::add_varargs; using expected_pmf = void (foo::*)(int, int&&, const int&, void*, ...) const; - static_assert(std::is_same{}, ""); // ^^^ + static_assert(std::is_same::value, ""); // ^^^ // note: MSVC likely requires __cdecl for a varargs PMF on your // machine, at least if you intend to do anything useful with it. diff --git a/include/callable_traits/detail/generalized_class.hpp b/include/callable_traits/detail/generalized_class.hpp index 2e86257..6c00467 100644 --- a/include/callable_traits/detail/generalized_class.hpp +++ b/include/callable_traits/detail/generalized_class.hpp @@ -22,22 +22,18 @@ namespace callable_traits { template struct can_make_reference { - template - static dummy test(typename std::remove_reference::type*); + template + static U& test(std::nullptr_t); - template - static void test(...); + static dummy test(...); - using type = decltype(can_make_reference::test(nullptr)); - static constexpr bool value = std::is_same::value; + using type = decltype(can_make_reference::test(nullptr)); + static constexpr bool value = !std::is_same::value; }; template struct is_class_after_dereference { - template - struct check {}; - template::value, U>::type, typename Dereferenced = decltype(*std::declval()), diff --git a/include/callable_traits/detail/placeholder.hpp b/include/callable_traits/detail/placeholder.hpp index a50adc5..5a32fb8 100644 --- a/include/callable_traits/detail/placeholder.hpp +++ b/include/callable_traits/detail/placeholder.hpp @@ -58,7 +58,7 @@ namespace callable_traits { ph_route< Expression, I, - std::is_placeholder>::value + std::is_placeholder::type>::value >... >; }; diff --git a/test/arity.cpp b/test/arity.cpp index 22c9378..14434fd 100644 --- a/test/arity.cpp +++ b/test/arity.cpp @@ -251,9 +251,12 @@ int main() { test_arity(); test_arity(); test_arity(); + +#ifndef CALLABLE_TRAITS_MSVC test_arity(); test_arity(); test_arity(); +#endif } { //testing function without varargs diff --git a/test/best_match_bind.cpp b/test/best_match_bind.cpp index 9957234..6e87ae8 100644 --- a/test/best_match_bind.cpp +++ b/test/best_match_bind.cpp @@ -72,7 +72,7 @@ int main() { using args = ct::args; using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); VampireRobotPoodle vampire_robot_poodle; assert(bind_obj(vampire_robot_poodle) == 0); @@ -97,7 +97,7 @@ int main() { using args = ct::args; using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); VampireRobotPoodle vampire_robot_poodle; assert(bind_obj(vampire_robot_poodle) == 0); diff --git a/test/bind_expression.cpp b/test/bind_expression.cpp index ea46454..4ef8961 100644 --- a/test/bind_expression.cpp +++ b/test/bind_expression.cpp @@ -94,42 +94,42 @@ int main() { auto expr = ct::bind_expr(&ordered_letters, _1, _2, _3, _4, _5, _6, _7); using args = ct::args; using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); auto test = std::bind(&ordered_letters, _1, _2, _3, _4, _5, _6, _7); assert(apply(test, expected_args{}) == "ABCDEFG"); } { auto expr = ct::bind_expr(&ordered_letters, a, b, c, _1, _2, _3, _4); using args = ct::args; using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); auto test = std::bind(&ordered_letters, a, b, c, _1, _2, _3, _4); assert(apply(test, expected_args{}) == "ABCDEFG"); } { auto expr = ct::bind_expr(&ordered_letters, _7, _6, _5, _4, _3, _2, _1); using args = ct::args; using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); auto test = std::bind(&ordered_letters, _7, _6, _5, _4, _3, _2, _1); assert(apply(test, expected_args{}) == "ABCDEFG"); } { auto expr = ct::bind_expr(&ordered_letters, a, b, c, _4, _3, _2, _1); using args = ct::args; using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); auto test = std::bind(&ordered_letters, a, b, c, _4, _3, _2, _1); assert(apply(test, expected_args{}) == "ABCDEFG"); } { auto expr = ct::bind_expr(&ordered_letters, _4, _3, _2, _1, e, f, g); using args = ct::args; using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); auto test = std::bind(&ordered_letters, _4, _3, _2, _1, e, f, g); assert(apply(test, expected_args{}) == "ABCDEFG"); } { auto expr = ct::bind_expr(&letters, _1, _1, _3, _3, _2, a, b); using args = ct::args; using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); } return 0; diff --git a/test/bind_expression_parser.cpp b/test/bind_expression_parser.cpp index c4df1f9..514b215 100644 --- a/test/bind_expression_parser.cpp +++ b/test/bind_expression_parser.cpp @@ -133,7 +133,7 @@ int main() { // the bind expression's placeholders using expected_args = std::tuple; - CT_ASSERT(std::is_same{}); + CT_ASSERT(std::is_same::value); auto runtime_test = BIND_WITH(std::bind); assert(apply(runtime_test, expected_args{}) == "ABCDEFG");