]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_quote.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / mp11 / test / mp_quote.cpp
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>
11 #include <boost/core/lightweight_test_trait.hpp>
12 #include <type_traits>
13
14 using boost::mp11::mp_invoke;
15
16 template<class...> struct X {};
17
18 template<template<class...> class F, class... T> using Y = X<F<T>...>;
19
20 template<class Q, class... T> using Z = X<mp_invoke<Q, T>...>;
21
22 template<class T, class U> struct P {};
23
24 template<class T, class U> using first = T;
25
26 int main()
27 {
28 using boost::mp11::mp_identity_t;
29 using boost::mp11::mp_quote;
30
31 {
32 using Q = mp_quote<mp_identity_t>;
33
34 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, void>, void>));
35 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, int[]>, int[]>));
36 }
37
38 {
39 using Q = mp_quote<mp_identity_t>;
40
41 #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 )
42 #else
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
47 #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 && BOOST_MSVC >= 1900 )
48 #else
49 using R2 = Z<Q, void, char, int>;
50 BOOST_TEST_TRAIT_TRUE((std::is_same<R2, X<void, char, int>>));
51 #endif
52 }
53
54 {
55 using Q = mp_quote<P>;
56
57 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, void, void>, P<void, void>>));
58 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, char[], int[]>, P<char[], int[]>>));
59 }
60
61 {
62 using Q = mp_quote<first>;
63
64 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, void, int>, void>));
65 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, char[], int[]>, char[]>));
66 }
67
68 return boost::report_errors();
69 }