mirror of
https://github.com/boostorg/mp11.git
synced 2025-08-03 22:44:27 +02:00
Feature/lambda (#96)
* added mp_lambda * launched GHA * skipped ICE-generating test in GCC < 4.9 * fixed GCC detection in workaround * test-skipped and documented GCC 4.8 bug * added missing s/const/CONST * tempirarily expanded macro to isolate problem with VS2017 * tried workaround for C3546 * tried another workaround * wrapped workaround up * dropped unnecessary devoiding in variadic (member) functions * temporary code to check VS compliance wrt function qualifiers * removed version printer * checked compliance with qualified (member) function partial specialization * checked each partial specialization individually * wrapped up VS2013 investigation * left variadics out of VS2013 * skipped noexcept-involving tests for VS2013 (keyword not supported) * given up on VS2013 support for mp_lambda * dropped lambda_devoid_args
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
////
|
////
|
||||||
Copyright 2019-2023 Peter Dimov
|
Copyright 2019-2024 Peter Dimov
|
||||||
|
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
@@ -10,6 +10,10 @@ http://www.boost.org/LICENSE_1_0.txt
|
|||||||
[#changelog]
|
[#changelog]
|
||||||
# Revision History
|
# Revision History
|
||||||
|
|
||||||
|
## Changes in 1.87.0
|
||||||
|
|
||||||
|
* Added `mp_lambda`
|
||||||
|
|
||||||
## Changes in 1.85.0
|
## Changes in 1.85.0
|
||||||
|
|
||||||
* Added `mp_sliding_fold`, a generalization of `mp_pairwise_fold` (contributed by Braden Ganetsky)
|
* Added `mp_sliding_fold`, a generalization of `mp_pairwise_fold` (contributed by Braden Ganetsky)
|
||||||
|
34
doc/mp11/lambda.adoc
Normal file
34
doc/mp11/lambda.adoc
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
////
|
||||||
|
Copyright 2024 Joaquin M Lopez Munoz
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
////
|
||||||
|
|
||||||
|
[#lambda]
|
||||||
|
# Lambda, <boost/mp11/lambda.hpp>
|
||||||
|
:toc:
|
||||||
|
:toc-title:
|
||||||
|
:idprefix:
|
||||||
|
|
||||||
|
## mp_lambda<T>
|
||||||
|
|
||||||
|
template<class T> using mp_lambda = /*...*/;
|
||||||
|
|
||||||
|
`mp_lambda<T>` is a quoted metafunction whose nested template `fn<U...>`
|
||||||
|
returns a type `V` with the same syntactic definition as `T`, except
|
||||||
|
that occurrences of placeholders in `T` are replaced by the corresponding
|
||||||
|
element of `U...`.
|
||||||
|
|
||||||
|
For example, `mp_lambda<std::pair<_1, _2*>>::fn<int, char>` is `std::pair<int, char*>`.
|
||||||
|
|
||||||
|
Replacement does not happen inside those constituent parts of `T` resulting
|
||||||
|
from the instantiation of a class template with non-type template parameters.
|
||||||
|
|
||||||
|
NOTE: In GCC 4.8, a compiler bug results in `const` and `volatile` qualifiers
|
||||||
|
being stripped from the returned type `V` (except when they are applied to
|
||||||
|
function or member function types).
|
||||||
|
|
||||||
|
NOTE: `mp_lambda` is not supported in VS2013 and prior due to compiler limitations.
|
@@ -1,5 +1,5 @@
|
|||||||
////
|
////
|
||||||
Copyright 2017 Peter Dimov
|
Copyright 2017-2024 Peter Dimov
|
||||||
|
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
@@ -33,6 +33,8 @@ include::function.adoc[]
|
|||||||
|
|
||||||
include::bind.adoc[]
|
include::bind.adoc[]
|
||||||
|
|
||||||
|
include::lambda.adoc[]
|
||||||
|
|
||||||
include::integer_sequence.adoc[]
|
include::integer_sequence.adoc[]
|
||||||
|
|
||||||
include::tuple.adoc[]
|
include::tuple.adoc[]
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#ifndef BOOST_MP11_HPP_INCLUDED
|
#ifndef BOOST_MP11_HPP_INCLUDED
|
||||||
#define BOOST_MP11_HPP_INCLUDED
|
#define BOOST_MP11_HPP_INCLUDED
|
||||||
|
|
||||||
// Copyright 2015 Peter Dimov.
|
// Copyright 2015-2024 Peter Dimov.
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
//
|
//
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <boost/mp11/map.hpp>
|
#include <boost/mp11/map.hpp>
|
||||||
#include <boost/mp11/set.hpp>
|
#include <boost/mp11/set.hpp>
|
||||||
#include <boost/mp11/bind.hpp>
|
#include <boost/mp11/bind.hpp>
|
||||||
|
#include <boost/mp11/lambda.hpp>
|
||||||
#include <boost/mp11/integer_sequence.hpp>
|
#include <boost/mp11/integer_sequence.hpp>
|
||||||
#include <boost/mp11/tuple.hpp>
|
#include <boost/mp11/tuple.hpp>
|
||||||
|
|
||||||
|
195
include/boost/mp11/lambda.hpp
Normal file
195
include/boost/mp11/lambda.hpp
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
#ifndef BOOST_MP11_LAMBDA_HPP_INCLUDED
|
||||||
|
#define BOOST_MP11_LAMBDA_HPP_INCLUDED
|
||||||
|
|
||||||
|
// Copyright 2024 Joaquin M Lopez Munoz.
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
//
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#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>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) || defined(__GNUC__)
|
||||||
|
# pragma push_macro( "I" )
|
||||||
|
# undef I
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace mp11
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class T> struct lambda_impl;
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
// mp_lambda
|
||||||
|
template<class T> using mp_lambda = typename detail::lambda_impl<T>::type;
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
// base case (no placeholder replacement)
|
||||||
|
template<class T> struct lambda_impl
|
||||||
|
{
|
||||||
|
template<class... U> using make = T;
|
||||||
|
using type = mp_bind<make>;
|
||||||
|
};
|
||||||
|
|
||||||
|
// placeholders (behave directly as mp_bind expressions)
|
||||||
|
template<std::size_t I> struct lambda_impl<mp_arg<I>>
|
||||||
|
{
|
||||||
|
using type = mp_arg<I>;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define BOOST_MP11_SPECIALIZE_LAMBDA_IMPL(name, compound_type) \
|
||||||
|
template<class T> using lambda_make_##name = compound_type; \
|
||||||
|
\
|
||||||
|
template<class T> struct lambda_impl<compound_type> \
|
||||||
|
{ \
|
||||||
|
using type = mp_bind<lambda_make_##name, mp_lambda<T>>; \
|
||||||
|
};
|
||||||
|
|
||||||
|
// [basic.type.qualifier]
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL(const, const T)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL(volatile, volatile T)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL(const_volatile, const volatile T)
|
||||||
|
|
||||||
|
// [dcl.ptr]
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL(pointer, T*)
|
||||||
|
|
||||||
|
// [dcl.ref]
|
||||||
|
// 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 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>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
// [dcl.array]
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL(array, T[])
|
||||||
|
|
||||||
|
#undef BOOST_MP11_SPECIALIZE_LAMBDA_IMPL
|
||||||
|
|
||||||
|
template<class T, std::size_t N> struct lambda_impl<T[N]>
|
||||||
|
{
|
||||||
|
template<class Q> using make = Q[N];
|
||||||
|
using type = mp_bind<make, mp_lambda<T>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
// [dcl.fct], [dcl.mptr] (member functions)
|
||||||
|
#define BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(name, qualifier) \
|
||||||
|
template<class R, class... T> using lambda_make_fct_##name = R(T...) qualifier; \
|
||||||
|
\
|
||||||
|
template<class R, class... T> struct lambda_impl<R(T...) qualifier> \
|
||||||
|
{ \
|
||||||
|
using type = mp_bind< \
|
||||||
|
lambda_make_fct_##name, \
|
||||||
|
mp_lambda<R>, mp_lambda<T>...>; \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
template<class R, class... T> using lambda_make_fct_##name##_ellipsis = \
|
||||||
|
R(T..., ...) qualifier; \
|
||||||
|
\
|
||||||
|
template<class R, class... T> struct lambda_impl<R(T..., ...) qualifier> \
|
||||||
|
{ \
|
||||||
|
using type = mp_bind< \
|
||||||
|
lambda_make_fct_##name##_ellipsis, \
|
||||||
|
mp_lambda<R>, mp_lambda<T>...>; \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
template<class R, class C, class... T> using lambda_make_mfptr_##name = \
|
||||||
|
R (C::*)(T...) qualifier; \
|
||||||
|
\
|
||||||
|
template<class R, class C, class... T> struct lambda_impl<R (C::*)(T...) qualifier> \
|
||||||
|
{ \
|
||||||
|
using type = mp_bind< \
|
||||||
|
lambda_make_mfptr_##name, \
|
||||||
|
mp_lambda<R>, mp_lambda<C>, mp_lambda<T>...>; \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
template<class R, class C, class... T> using lambda_make_mfptr_##name##_ellipsis = \
|
||||||
|
R (C::*)(T..., ...) qualifier; \
|
||||||
|
\
|
||||||
|
template<class R, class C, class... T> struct lambda_impl<R (C::*)(T..., ...) qualifier> \
|
||||||
|
{ \
|
||||||
|
using type = mp_bind< \
|
||||||
|
lambda_make_mfptr_##name##_ellipsis, \
|
||||||
|
mp_lambda<R>, mp_lambda<C>, mp_lambda<T>...>; \
|
||||||
|
};
|
||||||
|
|
||||||
|
#define BOOST_MP11_EMPTY()
|
||||||
|
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(no_qualifier, BOOST_MP11_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)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(ref, &)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_ref, const&)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(volatile_ref, volatile&)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_volatile_ref, const volatile&)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(rvalue_ref, &&)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_rvalue_ref, const&&)
|
||||||
|
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)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(volatile_noexcept, volatile noexcept)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_volatile_noexcept, const volatile noexcept)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(ref_noexcept, & noexcept)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_ref_noexcept, const& noexcept)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(volatile_ref_noexcept, volatile& noexcept)
|
||||||
|
BOOST_MP11_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR(const_volatile_ref_noexcept, const volatile& noexcept)
|
||||||
|
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_SPECIALIZE_LAMBDA_IMPL_FCT_AND_MFPTR
|
||||||
|
|
||||||
|
// [dcl.mptr] (data members)
|
||||||
|
template<class T, class C> struct lambda_impl<T (C::*)>
|
||||||
|
{
|
||||||
|
template<class U, class D> using make = U (D::*);
|
||||||
|
using type = mp_bind<make, mp_lambda<T>, mp_lambda<C>>;
|
||||||
|
};
|
||||||
|
|
||||||
|
// template class instantiation
|
||||||
|
template<template <class...> class C, class... Ts> struct lambda_impl<C<Ts...>>
|
||||||
|
{
|
||||||
|
using type = mp_bind<C, mp_lambda<Ts>...>;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace mp11
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) || defined(__GNUC__)
|
||||||
|
# pragma pop_macro( "I" )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // mp_lambda supported
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_MP11_LAMBDA_HPP_INCLUDED
|
@@ -1,6 +1,6 @@
|
|||||||
# Boost.Mp11 Library Test Jamfile
|
# Boost.Mp11 Library Test Jamfile
|
||||||
#
|
#
|
||||||
# Copyright 2015-2019 Peter Dimov
|
# Copyright 2015-2024 Peter Dimov
|
||||||
#
|
#
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# See accompanying file LICENSE_1_0.txt or copy at
|
# See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@@ -264,6 +264,9 @@ run mp_bind_q.cpp ;
|
|||||||
run mp_bind_front.cpp ;
|
run mp_bind_front.cpp ;
|
||||||
run mp_bind_back.cpp ;
|
run mp_bind_back.cpp ;
|
||||||
|
|
||||||
|
# lambda
|
||||||
|
run mp_lambda.cpp ;
|
||||||
|
|
||||||
# mpl
|
# mpl
|
||||||
run mpl.cpp : ;
|
run mpl.cpp : ;
|
||||||
run mpl_list.cpp : ;
|
run mpl_list.cpp : ;
|
||||||
|
154
test/mp_lambda.cpp
Normal file
154
test/mp_lambda.cpp
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
|
||||||
|
// Copyright 2024 Joaquin M Lopez Munoz.
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
//
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
|
||||||
|
#include <boost/mp11/detail/config.hpp>
|
||||||
|
|
||||||
|
#if BOOST_MP11_WORKAROUND(BOOST_MP11_MSVC, <= 1800)
|
||||||
|
|
||||||
|
#pragma message("Test skipped because mp_lambda is not supported")
|
||||||
|
int main() {}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/mp11/lambda.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <tuple>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
struct X;
|
||||||
|
enum E {};
|
||||||
|
|
||||||
|
#if BOOST_MP11_WORKAROUND(BOOST_MP11_GCC, < 40900)
|
||||||
|
// A bug in GCC < 4.9 results in const/volatile qualifiers being stripped
|
||||||
|
#define CONST
|
||||||
|
#define VOLATILE
|
||||||
|
#else
|
||||||
|
#define CONST const
|
||||||
|
#define VOLATILE volatile
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using namespace boost::mp11;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<int>::fn<>, int>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<int>::fn<void>, int>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<int*>::fn<void>, int*>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<X>::fn<>, X>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<X>::fn<void>, X>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<X*>::fn<void>, X*>));
|
||||||
|
|
||||||
|
#if !BOOST_MP11_WORKAROUND(BOOST_MP11_GCC, < 40900)
|
||||||
|
// GCC < 4.9 ICEs when dealing with enum types
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<E>::fn<void>, E>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<E*>::fn<void>, E*>));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1>::fn<int>, int>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_2>::fn<void, int>, int>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<const _1>::fn<int>, CONST int>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<volatile _1>::fn<int>, VOLATILE int>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<const volatile _2>::fn<void, int>, CONST VOLATILE int>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1*>::fn<int>, int*>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<const _1*>::fn<int>, CONST int*>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<const _1* const>::fn<int>, CONST int* CONST>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<const _1*>::fn<void>, CONST void*>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1&>::fn<int>, int&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<volatile _1*&>::fn<int>, VOLATILE int*&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1&&>::fn<int>, int&&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<volatile _1*&&>::fn<int>, VOLATILE int*&&>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1[]>::fn<int>, int[]>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1[5]>::fn<int>, int[5]>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1*[][5]>::fn<int>, int*[][5]>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2, _3)>::fn<int, char, double>, int(char, double)>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<int(_2)>::fn<void, char>, int(char)>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(void)>::fn<void>, void()>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2, _2*)>::fn<int, char>, int(char, char*)>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(*[])(_2)>::fn<int, char>, int(*[])(char)>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2, ...)>::fn<int, char>, int(char, ...)>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(X::*)(_2, ...)>::fn<int, char>, int(X::*)(char, ...)>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2)>::fn<int, char>, int(char)>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const>::fn<int, char>, int(char) const>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) volatile>::fn<int, char>, int(char) volatile>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const volatile>::fn<int, char>, int(char) const volatile>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2)&>::fn<int, char>, int(char)&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const&>::fn<int, char>, int(char) const&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) volatile&>::fn<int, char>, int(char) volatile&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const volatile&>::fn<int, char>, int(char) const volatile&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2)&&>::fn<int, char>, int(char)&&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const&&>::fn<int, char>, int(char) const&&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) volatile&&>::fn<int, char>, int(char) volatile&&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const volatile&&>::fn<int, char>, int(char) const volatile&&>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) noexcept>::fn<int, char>, int(char) noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const noexcept>::fn<int, char>, int(char) const noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) volatile noexcept>::fn<int, char>, int(char) volatile noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const volatile noexcept>::fn<int, char>, int(char) const volatile noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2)& noexcept>::fn<int, char>, int(char)& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const& noexcept>::fn<int, char>, int(char) const& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) volatile& noexcept>::fn<int, char>, int(char) volatile& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const volatile& noexcept>::fn<int, char>, int(char) const volatile& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2)&& noexcept>::fn<int, char>, int(char)&& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const&& noexcept>::fn<int, char>, int(char) const&& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) volatile&& noexcept>::fn<int, char>, int(char) volatile&& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1(_2) const volatile&& noexcept>::fn<int, char>, int(char) const volatile&& noexcept >));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2)>::fn<int, char, X>, int (X::*)(char)>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const>::fn<int, char, X>, int (X::*)(char) const>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) volatile>::fn<int, char, X>, int (X::*)(char) volatile>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const volatile>::fn<int, char, X>, int (X::*)(char) const volatile>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2)&>::fn<int, char, X>, int (X::*)(char)&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const&>::fn<int, char, X>, int (X::*)(char) const&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) volatile&>::fn<int, char, X>, int (X::*)(char) volatile&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const volatile&>::fn<int, char, X>, int (X::*)(char) const volatile&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2)&&>::fn<int, char, X>, int (X::*)(char)&&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const&&>::fn<int, char, X>, int (X::*)(char) const&&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) volatile&&>::fn<int, char, X>, int (X::*)(char) volatile&&>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const volatile&&>::fn<int, char, X>, int (X::*)(char) const volatile&&>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) noexcept>::fn<int, char, X>, int (X::*)(char) noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const noexcept>::fn<int, char, X>, int (X::*)(char) const noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) volatile noexcept>::fn<int, char, X>, int (X::*)(char) volatile noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const volatile noexcept>::fn<int, char, X>, int (X::*)(char) const volatile noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2)& noexcept>::fn<int, char, X>, int (X::*)(char)& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const& noexcept>::fn<int, char, X>, int (X::*)(char) const& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) volatile& noexcept>::fn<int, char, X>, int (X::*)(char) volatile& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const volatile& noexcept>::fn<int, char, X>, int (X::*)(char) const volatile& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2)&& noexcept>::fn<int, char, X>, int (X::*)(char)&& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const&& noexcept>::fn<int, char, X>, int (X::*)(char) const&& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) volatile&& noexcept>::fn<int, char, X>, int (X::*)(char) volatile&& noexcept >));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_3::*)(_2) const volatile&& noexcept>::fn<int, char, X>, int (X::*)(char) const volatile&& noexcept >));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<_1 (_2::*)>::fn<int, X>, int (X::*)>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<std::pair<_1, _2>>::fn<char, int>, std::pair<char, int>>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<std::pair<_2, _1>>::fn<char, int>, std::pair<int, char>>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<std::pair<const _1*, _2&>>::fn<char, int>, std::pair<CONST char*, int&>>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<std::tuple<_1, _2>>::fn<char, int>, std::tuple<char, int>>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<std::tuple<_2, _1>*>::fn<X, int>, std::tuple<int, X>*>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<std::tuple<const _1*, _2&>*>::fn<char, int>, std::tuple<CONST char*, int&>*>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<std::tuple<_3, std::pair<_2, _1>>>::fn<char, int, double>, std::tuple<double, std::pair<int, char>>>));
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<std::tuple<_1, _2>>::fn<_2, _1>, std::tuple<_2, _1>>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_lambda<mp_bind<std::pair, _1, _2>>::fn<char, int>, mp_bind<std::pair, _1, _2>>));
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user