diff --git a/include/boost/mp11/lambda.hpp b/include/boost/mp11/lambda.hpp index 9f78d55..3d027c2 100644 --- a/include/boost/mp11/lambda.hpp +++ b/include/boost/mp11/lambda.hpp @@ -11,7 +11,9 @@ #include #if BOOST_MP11_WORKAROUND(BOOST_MP11_MSVC, <= 1800) + // mp_lambda not supported due to compiler limitations + #else #include @@ -73,14 +75,14 @@ BOOST_MP11_SPECIALIZE_LAMBDA_IMPL(pointer, T*) // GCC < 7 fails with template using make = U&; template struct lambda_impl { - template using make = typename std::add_lvalue_reference::type; - using type = mp_bind>; + template using make = typename std::add_lvalue_reference::type; + using type = mp_bind>; }; template struct lambda_impl { - template using make = typename std::add_rvalue_reference::type; - using type = mp_bind>; + template using make = typename std::add_rvalue_reference::type; + using type = mp_bind>; }; // [dcl.array] @@ -135,9 +137,9 @@ template struct lambda_impl, mp_lambda, mp_lambda...>; \ }; -#define BOOST_MP11_EMPTY() +#define BOOST_MP11_LAMBDA_EMPTY() -BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(no_qualifier, BOOST_MP11_EMPTY()) +BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(no_qualifier, BOOST_MP11_LAMBDA_EMPTY()) BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const, const) BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(volatile, volatile) BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_volatile, const volatile) @@ -151,6 +153,7 @@ BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(volatile_rvalue_ref, volatile&&) BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_volatile_rvalue_ref, const volatile&&) #if (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L + // P0012R1: exception specification as part of the type system BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(noexcept, noexcept) BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_noexcept, const noexcept) @@ -164,15 +167,16 @@ BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(rvalue_ref_noexcept, && noexcept BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_rvalue_ref_noexcept, const&& noexcept) BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(volatile_rvalue_ref_noexcept, volatile&& noexcept) BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_volatile_rvalue_ref_noexcept, const volatile&& noexcept) + #endif // P0012R1 -#undef BOOST_MP11_EMPTY +#undef BOOST_MP11_LAMBDA_EMPTY #undef BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR // [dcl.mptr] (data members) -template struct lambda_impl +template struct lambda_impl { - template using make = U (D::*); + template using make = U D::*; using type = mp_bind, mp_lambda>; }; diff --git a/test/mp_lambda.cpp b/test/mp_lambda.cpp index d81cf85..992c7d0 100644 --- a/test/mp_lambda.cpp +++ b/test/mp_lambda.cpp @@ -11,7 +11,7 @@ #if BOOST_MP11_WORKAROUND(BOOST_MP11_MSVC, <= 1800) -#pragma message("Test skipped because mp_lambda is not supported") +#pragma message("Test skipped because BOOST_MP11_MSVC <= 1800") int main() {} #else @@ -54,19 +54,19 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, CONST int>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, VOLATILE int>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, CONST VOLATILE int>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int CONST>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int VOLATILE>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int CONST VOLATILE>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int*>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, CONST int*>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, CONST int* CONST>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, CONST void*>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int CONST*>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int CONST* CONST>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, void CONST*>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int&>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, VOLATILE int*&>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int VOLATILE *&>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int&&>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, VOLATILE int*&&>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int VOLATILE *&&>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int[]>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int[5]>)); @@ -74,7 +74,7 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char, double)>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char)>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, void()>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, void()>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char, char*)>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(*[])(char)>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char, ...)>)); @@ -93,18 +93,18 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) volatile&&>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const volatile&&>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) volatile noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const volatile noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char)& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) volatile& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const volatile& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char)&& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const&& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) volatile&& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const volatile&& noexcept >)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) volatile noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const volatile noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char)& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) volatile& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const volatile& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char)&& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const&& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) volatile&& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int(char) const volatile&& noexcept>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char)>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const>)); @@ -119,28 +119,28 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) volatile&&>)); BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const volatile&&>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) volatile noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const volatile noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char)& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) volatile& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const volatile& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char)&& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const&& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) volatile&& noexcept >)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const volatile&& noexcept >)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) volatile noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const volatile noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char)& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) volatile& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const volatile& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char)&& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const&& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) volatile&& noexcept>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)(char) const volatile&& noexcept>)); - BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int (X::*)>)); + BOOST_TEST_TRAIT_TRUE((std::is_same::fn, int X::*>)); BOOST_TEST_TRAIT_TRUE((std::is_same>::fn, std::pair>)); BOOST_TEST_TRAIT_TRUE((std::is_same>::fn, std::pair>)); - BOOST_TEST_TRAIT_TRUE((std::is_same>::fn, std::pair>)); + BOOST_TEST_TRAIT_TRUE((std::is_same>::fn, std::pair>)); BOOST_TEST_TRAIT_TRUE((std::is_same>::fn, std::tuple>)); BOOST_TEST_TRAIT_TRUE((std::is_same*>::fn, std::tuple*>)); - BOOST_TEST_TRAIT_TRUE((std::is_same*>::fn, std::tuple*>)); + BOOST_TEST_TRAIT_TRUE((std::is_same*>::fn, std::tuple*>)); BOOST_TEST_TRAIT_TRUE((std::is_same>>::fn, std::tuple>>)); BOOST_TEST_TRAIT_TRUE((std::is_same>::fn<_2, _1>, std::tuple<_2, _1>>));