]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | |
2 | // Copyright 2015, 2017 Peter Dimov. | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0. | |
5 | // | |
6 | // See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt | |
8 | ||
9 | ||
10 | #include <boost/mp11/utility.hpp> | |
92f5a8d4 | 11 | #include <boost/mp11/detail/config.hpp> |
b32b8144 FG |
12 | #include <boost/core/lightweight_test_trait.hpp> |
13 | #include <type_traits> | |
14 | ||
92f5a8d4 | 15 | using boost::mp11::mp_invoke_q; |
b32b8144 FG |
16 | |
17 | template<class...> struct X {}; | |
18 | ||
19 | template<template<class...> class F, class... T> using Y = X<F<T>...>; | |
20 | ||
92f5a8d4 | 21 | template<class Q, class... T> using Z = X<mp_invoke_q<Q, T>...>; |
b32b8144 FG |
22 | |
23 | template<class T, class U> struct P {}; | |
24 | ||
25 | template<class T, class U> using first = T; | |
26 | ||
27 | int main() | |
28 | { | |
29 | using boost::mp11::mp_identity_t; | |
30 | using boost::mp11::mp_quote; | |
31 | ||
32 | { | |
33 | using Q = mp_quote<mp_identity_t>; | |
34 | ||
92f5a8d4 TL |
35 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke_q<Q, void>, void>)); |
36 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke_q<Q, int[]>, int[]>)); | |
b32b8144 FG |
37 | } |
38 | ||
39 | { | |
40 | using Q = mp_quote<mp_identity_t>; | |
41 | ||
92f5a8d4 | 42 | #if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) |
b32b8144 FG |
43 | using R1 = Y<Q::fn, void, char, int>; |
44 | BOOST_TEST_TRAIT_TRUE((std::is_same<R1, X<void, char, int>>)); | |
45 | #endif | |
46 | ||
92f5a8d4 | 47 | #if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 && BOOST_MP11_MSVC >= 1900 ) |
b32b8144 FG |
48 | using R2 = Z<Q, void, char, int>; |
49 | BOOST_TEST_TRAIT_TRUE((std::is_same<R2, X<void, char, int>>)); | |
50 | #endif | |
51 | } | |
52 | ||
53 | { | |
54 | using Q = mp_quote<P>; | |
55 | ||
92f5a8d4 TL |
56 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke_q<Q, void, void>, P<void, void>>)); |
57 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke_q<Q, char[], int[]>, P<char[], int[]>>)); | |
b32b8144 FG |
58 | } |
59 | ||
60 | { | |
61 | using Q = mp_quote<first>; | |
62 | ||
92f5a8d4 TL |
63 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke_q<Q, void, int>, void>)); |
64 | BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke_q<Q, char[], int[]>, char[]>)); | |
b32b8144 FG |
65 | } |
66 | ||
67 | return boost::report_errors(); | |
68 | } |