From 959dcca860909d28ed6b2a0232fcfe45864b5f6f Mon Sep 17 00:00:00 2001 From: badair Date: Sat, 26 Mar 2016 01:38:08 -0500 Subject: [PATCH] undoing /Wall hacks for MSVC, adding best_match --- CMakeLists.txt | 14 +- example/ambiguity.cpp | 3 - example/bind_expr/example_1.cpp | 3 - example/bind_expr/example_2.cpp | 6 +- example/intro.cpp | 148 +++++++++++++----- example/void.cpp | 3 - include/callable_traits/best_match.hpp | 129 +++++++++++++++ .../bind_expression_parser.hpp | 10 +- include/callable_traits/callable_traits.hpp | 61 ++++++++ include/callable_traits/sort_tuple.hpp | 2 + include/callable_traits/tuple_group_by.hpp | 3 +- include/callable_traits/weak_common_type.hpp | 84 ---------- test/args.cpp | 2 - test/arity.cpp | 3 - test/bind_expression.cpp | 2 - test/bind_expression_parser.cpp | 3 - test/can_invoke.cpp | 3 - test/can_invoke_libcxx.cpp | 6 +- test/decorate_like.cpp | 3 - test/has_varargs.cpp | 3 - test/result_of.cpp | 3 - test/weak_common_type.cpp | 3 - 22 files changed, 327 insertions(+), 170 deletions(-) create mode 100644 include/callable_traits/best_match.hpp delete mode 100644 include/callable_traits/weak_common_type.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f91ab53..d86a204 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,12 +37,20 @@ callable_traits_append_flag(callable_traits_HAS_FTEMPLATE_BACKTRACE_LIMIT -ftem callable_traits_append_flag(callable_traits_HAS_PEDANTIC -pedantic) callable_traits_append_flag(callable_traits_HAS_STDCXX1Y -std=c++1y) callable_traits_append_flag(callable_traits_HAS_QUNUSED_ARGUMENTS -Qunused-arguments) -callable_traits_append_flag(callable_traits_HAS_W -W) -callable_traits_append_flag(callable_traits_HAS_WALL -Wall) -callable_traits_append_flag(callable_traits_HAS_WEXTRA -Wextra) callable_traits_append_flag(callable_traits_HAS_WNO_UNUSED_LOCAL_TYPEDEFS -Wno-unused-local-typedefs) callable_traits_append_flag(callable_traits_HAS_WWRITE_STRINGS -Wwrite-strings) +if(MSVC) + callable_traits_append_flag(callable_traits_HAS_W3 -W3) + + #disable warning about symbol truncation. Doesn't matter, affected types are not linked + callable_traits_append_flag(callable_traits_HAS_WD4503 -wd4503) +else() + callable_traits_append_flag(callable_traits_HAS_W -W) + callable_traits_append_flag(callable_traits_HAS_WALL -Wall) + callable_traits_append_flag(callable_traits_HAS_WEXTRA -Wextra) +endif() + #find_package(Boost) #if (Boost_FOUND) # include_directories(${Boost_INCLUDE_DIRS}) diff --git a/example/ambiguity.cpp b/example/ambiguity.cpp index 23931b7..91f6d0b 100644 --- a/example/ambiguity.cpp +++ b/example/ambiguity.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/example/bind_expr/example_1.cpp b/example/bind_expr/example_1.cpp index b77b4e3..eb5b09e 100644 --- a/example/bind_expr/example_1.cpp +++ b/example/bind_expr/example_1.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/example/bind_expr/example_2.cpp b/example/bind_expr/example_2.cpp index 8b84b1b..ce01a7e 100644 --- a/example/bind_expr/example_2.cpp +++ b/example/bind_expr/example_2.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include @@ -76,6 +73,9 @@ int main() { _1 ); + // the last _1 placeholder in this bind expression forces all other + // _1 slots to accept VampireRobotPoodle, the narrowest of the bunch. + using bind_args = ct::args; using expected_args = std::tuple; static_assert(std::is_same{}, ""); diff --git a/example/intro.cpp b/example/intro.cpp index 3933956..47f9c27 100644 --- a/example/intro.cpp +++ b/example/intro.cpp @@ -1,24 +1,27 @@ /* - 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) +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) */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include #include - // This example uses a function object. All features shown in this example - // can be used for other callable types, including (but not limited to) function - // pointers and member function pointers. Ambiguous callables (e.g. function - // objects with templated/overloaded operator()) are not discussed in this example. +// Most of this example uses a function object. Unless otherwise noted, all +// features shown in this example can be used for any "callable" types: +// lambdas, generic lambdas, function pointers, function references, +// function types, abominable function types, member function pointers, and +// member data pointers. Ambiguous callables (e.g. function objects with +// templated/overloaded operator()) are not addressed in this example, but +// are recognized and handled by CallableTraits. + +// Note: For more information about abominable function types, see Alisdair Meredith's +// proposal at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0172r0.html struct foo { - void operator()(int, char, float, void* = nullptr) const {} + void operator()(int, int&&, const int&, void* = nullptr) const {} }; namespace ct = callable_traits; @@ -28,11 +31,12 @@ int main() { // indexed argument types using second_arg = ct::arg_at<1, foo>; - static_assert(std::is_same{}, ""); + static_assert(std::is_same{}, ""); - // arguments in a tuple + // 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; + using expected_args = std::tuple; static_assert(std::is_same{}, ""); //callable_traits::result_of is a bit friendlier than std::result_of @@ -41,19 +45,30 @@ int main() { // callable_traits::signature yields a plain function type using signature = ct::signature; - using expected_signature = void(int, char, float, void*); + using expected_signature = void(int, int&&, const int&, void*); static_assert(std::is_same{}, ""); // when trait information can be conveyed in an integral_constant, - // callable_traits uses functions instead of template aliases. - // The line below could use ct::arity() instead. This applies - // to all function-style type traits. Note: min_arity and max_arity - // only differ from arity when the argument is a function object. + // callable_traits uses constexpr functions instead of template aliases. + // Note: min_arity and max_arity only differ logically from arity when + // the argument is a function object. static_assert(ct::arity(foo{}) == 4, ""); static_assert(ct::max_arity(foo{}) == 4, ""); static_assert(ct::min_arity(foo{}) == 3, ""); - // C-style varargs (`...` in a signature) can be detected. + // CallableTraits provides constexpr functions so that the user doesn't + // need to worry about reference collapsing or decltype when dealing with + // universal references to callables. Still, you don't need an instance, + // because CallableTraits provides non-deduced function templates for + // all constexpr functions besides can_invoke and bind_expr, which + // model std::invoke and std::bind, respectively (more on these below). + // Here's an example of the non-deduced functions, which take an explicit + // type argument. We'll ignore these for the rest of the example. + static_assert(ct::arity() == 4, ""); + static_assert(ct::max_arity() == 4, ""); + static_assert(ct::min_arity() == 3, ""); + + // C-style varargs (ellipses in a signature) can be detected. static_assert(!ct::has_varargs(foo{}), ""); // callable_traits::is_ambiguous yields std::true_type @@ -64,43 +79,104 @@ int main() { // std::invoke will compile with the given arguments. Keep // in mind that failing cases must be SFINAE-friendly (i.e. // any failing static_asserts can still be tripped). Note: The - // same is true for min_arity and max_arity on function objects. - static_assert(ct::can_invoke(foo{}, 1, 'a', 3.0), ""); - // no error: std::invoke(foo{}, 1, 'a', 3.0); + // same sfinae restrictions apply to min_arity and max_arity + // for function objects. + int i = 0; + static_assert(ct::can_invoke(foo{}, 0, 0, i), ""); + // no error: std::invoke(foo{}, 0, 0, i); static_assert(!ct::can_invoke(foo{}, nullptr), ""); // error: std::invoke(foo{}, nullptr); - // callable_traits::bind_expr parses bind expressions. Nested bind - // expressions are also handled, but are not shown in this example. + // callable_traits::bind_expr is a compile-time bind expression parser, + // very loosely based on the Boost.Bind implementation. Nested bind + // expressions are fully supported. The return type of bind_expr only + // contains type information, but can still be used in an evaluated + // context. The return type can be treated like a callable type when passed + // to result_of, signature, args, or arg_at template aliases. using bind_expression = decltype(ct::bind_expr(foo{}, _1, _1, _1)); - // int is chosen as the expected argument for the bind expression - // because it's the best fit for all three placeholder slots. + // Unfortunately, we can't do type manipulations with std::bind directly, + // because the ISO C++ standard says very little about the return type of + // std::bind. The purpose of callable_traits::bind_expr is to undo some of + // the arbitrary black-boxing that std::bind incurs. + auto bind_obj = std::bind(foo{}, _1, _1, _1); + + // Here, int is chosen as the expected argument for the bind expression + // because it's the best fit for all three placeholder slots. Behind + // the scenes, this is determined by a cartesian product of conversion + // combinations of the known parameter types represented by the reused + // placeholders (yes, this is slow). The type with the highest number of + // successful conversions "wins". int is chosen over int&& because + // non-reference types are preferred in the case of a tie. static_assert(std::is_same< ct::args, std::tuple >{}, ""); - // Unfortunately, we can't do type manipulations with std::bind directly, - // because the ISO C++ standard says very little about the return type of - //std::bind. So, we call std::bind in the same way we called ct::bind_expr - // above. If there is interest within Boost, this functionality can be - // integrated into Boost.Bind (on which this implementation is loosely based). - auto bind_obj = std::bind(foo{}, _1, _1, _1); - // callable_traits can facilitate the construction of std::function objects. auto fn = std::function>{ bind_obj }; fn(0); // For function objects, the following checks are determined by the - // qualifiers on operator(). For member function pointers and abominable - // function types, the qualifier on the function type are used. + // qualifiers on operator(), rather than the category of the passed value. + // For member function pointers and abominable function types, the + // qualifier on the function type are used. static_assert(ct::is_const_qualified(foo{}), ""); static_assert(!ct::is_volatile_qualified(foo{}), ""); static_assert(!ct::is_reference_qualified(foo{}), ""); static_assert(!ct::is_lvalue_reference_qualified(foo{}), ""); static_assert(!ct::is_rvalue_reference_qualified(foo{}), ""); + + + // If you find yourself in the unfortunate situation of needing + // to manipulate member function pointer types, CallableTraits + // has all the tools you need to maintain your sanity. + + + + using pmf = decltype(&foo::operator()); + + { + // 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{}, ""); + } + + { + // 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{}, ""); + } + + { + // 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{}, ""); // ^^^^ + } + + // You get the picture. CallableTraits lets you add and remove all PMF + // qualifiers (const, volatile, &, &&, and any combination thereof). + // These type operations can be performed on abominable function types as well. + + + // Somehow, somewhere, there was a sad programmer who wanted to + // manipulate c-style varargs in a function signature. There's + // really no way to do this universally without doing all the work + // that CallableTraits already does, so CallableTraits includes in + // an add/remove feature for this, too. + { + + using varargs_pmf = ct::add_varargs; + using expected_pmf = void (foo::*)(int, int&&, const int&, void*, ...) const; + static_assert(std::is_same{}, ""); // ^^^ + + // note: MSVC likely requires __cdecl for a varargs PMF on your + // machine, at least if you intend to do anything useful with it. + } + return 0; } \ No newline at end of file diff --git a/example/void.cpp b/example/void.cpp index 8c5f701..ed9eae5 100644 --- a/example/void.cpp +++ b/example/void.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/include/callable_traits/best_match.hpp b/include/callable_traits/best_match.hpp new file mode 100644 index 0000000..9e08fbb --- /dev/null +++ b/include/callable_traits/best_match.hpp @@ -0,0 +1,129 @@ +/*! +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) +*/ + +#ifndef CALLABLE_TRAITS_BEST_MATCH_HPP +#define CALLABLE_TRAITS_BEST_MATCH_HPP + +#include +#include +#include + +namespace callable_traits { + + namespace ctdetail { + template class, typename...> + struct filter_impl; + + template class Pred> + struct filter_impl { + using type = std::tuple<>; + }; + + template class Pred, typename Head, typename ...Tail> + struct filter_impl + { + using type = typename std::conditional::value, + typename prepend::type>::type, + typename filter_impl::type + >::type; + }; + + template class Pred, typename... Ts> + using filter = typename filter_impl::type; + + template + struct can_convert { + + //todo - this should probably use std::is_convertible instead + template + struct apply { + + struct bad{}; + + template()(std::declval()))> + static Ret test(U); + + template + static bad test(...); + + using test_type = void(*)(K); + using result = decltype(test(test_type{})); + + static constexpr const bool value = !std::is_same::value; + }; + }; + + template + struct conversion_result { + using key = T; + using successful_conversions = Tup; + static constexpr const std::size_t count = std::tuple_size::value; + }; + + template + using map_conversions = + conversion_result::template apply, Ts...>>; + + template + struct conversion_result_sort_predicate { + + using candidate = typename T::key; + using other = typename U::key; + + using no_ref = typename std::remove_reference::type; + using no_ref_other = typename std::remove_reference::type; + + static constexpr bool const is_better_match = T::count > U::count; + static constexpr bool const is_same_match = T::count == U::count; + + static constexpr bool const is_lref = std::is_lvalue_reference::value; + static constexpr bool const is_rref = std::is_rvalue_reference::value; + static constexpr bool const is_ref = is_lref || is_rref; + static constexpr bool const is_const = std::is_const::value; + + static constexpr bool const is_other_lref = std::is_lvalue_reference::value; + static constexpr bool const is_other_rref = std::is_rvalue_reference::value; + static constexpr bool const is_other_ref = is_other_lref || is_other_rref; + static constexpr bool const is_other_const = std::is_const::value; + + static constexpr bool const has_better_reference = + (!is_ref && is_other_ref) || (is_lref && is_other_rref); + + static constexpr bool const has_same_reference = + is_lref == is_other_lref && is_rref == is_other_rref; + + static constexpr bool const has_better_const = (is_const && !is_other_const); + + static constexpr bool const has_same_const =is_const == is_other_const; + + static constexpr const bool value = + is_better_match + || (is_same_match && has_better_reference) + || (is_same_match && has_same_reference && has_better_const); + }; + + template + using sorted_cartesian_product_of_conversions = sort_tuple< + std::tuple...>, + conversion_result_sort_predicate + >; + + template + using best_conversion_result = + typename std::tuple_element<0, sorted_cartesian_product_of_conversions>::type; + + template + using best_match = typename best_conversion_result::key; + + template + using has_valid_match = std::integral_constant::count == sizeof...(Ts) + >; + } +} + +#endif \ No newline at end of file diff --git a/include/callable_traits/bind_expression_parser.hpp b/include/callable_traits/bind_expression_parser.hpp index 7e1a7fa..66d49d9 100644 --- a/include/callable_traits/bind_expression_parser.hpp +++ b/include/callable_traits/bind_expression_parser.hpp @@ -15,7 +15,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include #include -#include +#include #include #include @@ -81,11 +81,11 @@ namespace callable_traits { }; template - struct custom_common_type; + struct find_best_match; template - struct custom_common_type> { - using type = weak_common_type; + struct find_best_match> { + using type = best_match; }; template @@ -102,7 +102,7 @@ namespace callable_traits { >; using type = typename prepend< - typename custom_common_type::type>::type, + typename find_best_match::type>::type, typename common_expected_arg_types>::type >::type; }; diff --git a/include/callable_traits/callable_traits.hpp b/include/callable_traits/callable_traits.hpp index 962213a..f936376 100644 --- a/include/callable_traits/callable_traits.hpp +++ b/include/callable_traits/callable_traits.hpp @@ -10,6 +10,11 @@ Distributed under the Boost Software License, Version 1.0. #ifndef CALLABLE_TRAITS_HPP #define CALLABLE_TRAITS_HPP +#ifdef _MSVC_VER +#pragma warning(push) +#pragma warning(disable : 4503) +#endif //ifdef _MSVC_VER + #include #include #include @@ -200,6 +205,62 @@ namespace callable_traits { is_rvalue_reference_qualified(Callable&&) { return typename ctdetail::traits::is_rvalue_reference_qualified{}; } + + template + using remove_const_qualifier = + typename ctdetail::traits::remove_const; + + template + using remove_volatile_qualifier = + typename ctdetail::traits::remove_volatile; + + template + using remove_cv_qualifiers = + typename ctdetail::traits::remove_cv; + + template + using remove_lvalue_qualifier = + typename ctdetail::traits::remove_lvalue_reference; + + template + using remove_rvalue_qualifier = + typename ctdetail::traits::remove_rvalue_reference; + + template + using remove_reference_qualifiers = + typename ctdetail::traits::remove_reference; + + template + using remove_varargs = + typename ctdetail::traits::remove_varargs; + + template + using add_const_qualifier = + typename ctdetail::traits::add_const; + + template + using add_volatile_qualifier = + typename ctdetail::traits::add_volatile; + + template + using add_cv_qualifiers = + typename ctdetail::traits::add_cv; + + template + using add_lvalue_qualifier = + typename ctdetail::traits::add_lvalue_reference; + + template + using add_rvalue_qualifier = + typename ctdetail::traits::add_rvalue_reference; + + template + using add_varargs = + typename ctdetail::traits::add_varargs; } +#ifdef _MSVC_VER +#pragma warning(pop) +#endif //ifdef _MSVC_VER + #endif \ No newline at end of file diff --git a/include/callable_traits/sort_tuple.hpp b/include/callable_traits/sort_tuple.hpp index 5474166..76d096f 100644 --- a/include/callable_traits/sort_tuple.hpp +++ b/include/callable_traits/sort_tuple.hpp @@ -10,6 +10,8 @@ Distributed under the Boost Software License, Version 1.0. #ifndef CALLABLE_TRAITS_SORT_TUPLE_HPP #define CALLABLE_TRAITS_SORT_TUPLE_HPP + + #include #include diff --git a/include/callable_traits/tuple_group_by.hpp b/include/callable_traits/tuple_group_by.hpp index 74c2b07..43ee0d2 100644 --- a/include/callable_traits/tuple_group_by.hpp +++ b/include/callable_traits/tuple_group_by.hpp @@ -54,8 +54,9 @@ namespace callable_traits { template struct group_by_filter_impl { + using pred_result = decltype(std::declval()(std::declval())); using type = typename std::conditional< - decltype(std::declval()(std::declval()))::value, + pred_result::value, typename prepend::type>::type, typename group_by_filter_impl::type >::type; diff --git a/include/callable_traits/weak_common_type.hpp b/include/callable_traits/weak_common_type.hpp deleted file mode 100644 index f58ac3e..0000000 --- a/include/callable_traits/weak_common_type.hpp +++ /dev/null @@ -1,84 +0,0 @@ -/*! -Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. -Copyright (c) 2001 David Abrahams -Copyright (c) 2005 Peter Dimov -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) -*/ - -#ifndef CALLABLE_TRAITS_WEAK_COMMON_TYPE_HPP -#define CALLABLE_TRAITS_WEAK_COMMON_TYPE_HPP - -#include - -namespace callable_traits { - - namespace ctdetail { - - template - struct weak_common_type_t; - - template - struct weak_common_type_t { - using type = T; - }; - - template - struct weak_common_type_t< - std::integral_constant< - bool, - !std::is_convertible::value && std::is_convertible::value - >, T, U - > { - using type = T; - }; - - template - struct weak_common_type_t< - std::integral_constant< - bool, - std::is_convertible::value - && std::is_convertible::value - >, T, U - > { - using type = T; - }; - - template - struct weak_common_type_t< - std::integral_constant< - bool, - std::is_convertible::value && !std::is_convertible::value - >, T, U - > { - using type = U; - }; - - template - struct weak_common_type_t< - std::integral_constant< - bool, - !std::is_convertible::value && !std::is_convertible::value - >, T, U - > { - using type = T; - }; - - template - struct weak_common_type_t { - - using type = typename weak_common_type_t< - std::true_type, - typename weak_common_type_t::type, - V... - >::type; - }; - - template - using weak_common_type = typename weak_common_type_t::type; - } -} - -#endif \ No newline at end of file diff --git a/test/args.cpp b/test/args.cpp index 91af747..2a442bd 100644 --- a/test/args.cpp +++ b/test/args.cpp @@ -5,8 +5,6 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) #include #include diff --git a/test/arity.cpp b/test/arity.cpp index b125dcf..3ab49b0 100644 --- a/test/arity.cpp +++ b/test/arity.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/test/bind_expression.cpp b/test/bind_expression.cpp index 73355c4..ea46454 100644 --- a/test/bind_expression.cpp +++ b/test/bind_expression.cpp @@ -5,8 +5,6 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) #include #include diff --git a/test/bind_expression_parser.cpp b/test/bind_expression_parser.cpp index 812c877..ce41cce 100644 --- a/test/bind_expression_parser.cpp +++ b/test/bind_expression_parser.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/test/can_invoke.cpp b/test/can_invoke.cpp index 7fcf197..af121d5 100644 --- a/test/can_invoke.cpp +++ b/test/can_invoke.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/test/can_invoke_libcxx.cpp b/test/can_invoke_libcxx.cpp index b69a5de..e72b112 100644 --- a/test/can_invoke_libcxx.cpp +++ b/test/can_invoke_libcxx.cpp @@ -41,14 +41,12 @@ /// described in the previous item; /// (1.5) - f(t1, t2, ..., tN) in all other cases. -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include #include + #ifndef CT_ASSERT #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT @@ -150,7 +148,7 @@ void bullet_one_two_tests() { test_b12(cl); //MSVC doesn't handle these correctly -#if not defined(_MSC_VER) || _MSC_VER > 1900 +#if ! defined(_MSC_VER) || _MSC_VER > 1900 test_b12(std::move(cl)); test_b12(std::move(cl)); test_b12(std::move(cl)); diff --git a/test/decorate_like.cpp b/test/decorate_like.cpp index 5bb8d57..b32f638 100644 --- a/test/decorate_like.cpp +++ b/test/decorate_like.cpp @@ -7,9 +7,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/test/has_varargs.cpp b/test/has_varargs.cpp index 652432c..c58208c 100644 --- a/test/has_varargs.cpp +++ b/test/has_varargs.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/test/result_of.cpp b/test/result_of.cpp index 6405e12..b7698ca 100644 --- a/test/result_of.cpp +++ b/test/result_of.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include diff --git a/test/weak_common_type.cpp b/test/weak_common_type.cpp index 5f321ba..9957234 100644 --- a/test/weak_common_type.cpp +++ b/test/weak_common_type.cpp @@ -6,9 +6,6 @@ Distributed under the Boost Software License, Version 1.0. */ -//useless MSVC /Wall warnings -#pragma warning(disable: 4514 4711) - #include #include #include