mirror of
https://github.com/boostorg/mp11.git
synced 2025-12-04 23:59:21 +01:00
Rename Q::apply to Q::invoke, mp_unquote to mp_invoke.
This commit is contained in:
56
test/mp_invoke.cpp
Normal file
56
test/mp_invoke.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
// Copyright 2015, 2017 Peter Dimov.
|
||||
//
|
||||
// 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/utility.hpp>
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
using boost::mp11::mp_invoke;
|
||||
using boost::mp11::mp_size_t;
|
||||
|
||||
struct Q1
|
||||
{
|
||||
template<class...> using invoke = void;
|
||||
};
|
||||
|
||||
struct Q2
|
||||
{
|
||||
template<class...> class invoke;
|
||||
};
|
||||
|
||||
struct Q3
|
||||
{
|
||||
template<class... T> using invoke = mp_size_t<sizeof...(T)>;
|
||||
};
|
||||
|
||||
struct Q4
|
||||
{
|
||||
template<class T1, class... T> using invoke = T1;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q1>, void>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q1, int>, void>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q1, int[], char[]>, void>));
|
||||
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q2>, Q2::invoke<>>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q2, int>, Q2::invoke<int>>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q2, int[], char[]>, Q2::invoke<int[], char[]>>));
|
||||
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q3>, mp_size_t<0>>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q3, int>, mp_size_t<1>>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q3, int[], char[]>, mp_size_t<2>>));
|
||||
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q4, int>, int>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q4, int[], char[]>, int[]>));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user