1
0
forked from boostorg/mp11

Stylistic changes to mp_lambda

This commit is contained in:
Peter Dimov
2024-10-14 19:37:36 +03:00
parent 23fd16647e
commit 8ceb48b4c9
2 changed files with 50 additions and 46 deletions

View File

@@ -11,7 +11,9 @@
#include <boost/mp11/detail/config.hpp>
#if BOOST_MP11_WORKAROUND(BOOST_MP11_MSVC, <= 1800)
// mp_lambda not supported due to compiler limitations
#else
#include <boost/mp11/bind.hpp>
@@ -73,14 +75,14 @@ BOOST_MP11_SPECIALIZE_LAMBDA_IMPL(pointer, T*)
// GCC < 7 fails with template<class U> using make = U&;
template<class T> struct lambda_impl<T&>
{
template<class U> using make = typename std::add_lvalue_reference<U>::type;
using type = mp_bind<make, mp_lambda<T>>;
template<class U> using make = typename std::add_lvalue_reference<U>::type;
using type = mp_bind<make, mp_lambda<T>>;
};
template<class T> struct lambda_impl<T&&>
{
template<class U> using make = typename std::add_rvalue_reference<U>::type;
using type = mp_bind<make, mp_lambda<T>>;
template<class U> using make = typename std::add_rvalue_reference<U>::type;
using type = mp_bind<make, mp_lambda<T>>;
};
// [dcl.array]
@@ -135,9 +137,9 @@ template<class R, class C, class... T> struct lambda_impl<R (C::*)(T..., ...) qu
mp_lambda<R>, mp_lambda<C>, mp_lambda<T>...>; \
};
#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<class T, class C> struct lambda_impl<T (C::*)>
template<class T, class C> struct lambda_impl<T C::*>
{
template<class U, class D> using make = U (D::*);
template<class U, class D> using make = U D::*;
using type = mp_bind<make, mp_lambda<T>, mp_lambda<C>>;
};