]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_quote.cpp
2 // Copyright 2015, 2017 Peter Dimov.
4 // Distributed under the Boost Software License, Version 1.0.
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
10 #include <boost/mp11/utility.hpp>
11 #include <boost/core/lightweight_test_trait.hpp>
12 #include <type_traits>
14 using boost::mp11::mp_invoke
;
16 template<class...> struct X
{};
18 template<template<class...> class F
, class... T
> using Y
= X
<F
<T
>...>;
20 template<class Q
, class... T
> using Z
= X
<mp_invoke
<Q
, T
>...>;
22 template<class T
, class U
> struct P
{};
24 template<class T
, class U
> using first
= T
;
28 using boost::mp11::mp_identity_t
;
29 using boost::mp11::mp_quote
;
32 using Q
= mp_quote
<mp_identity_t
>;
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[]>));
39 using Q
= mp_quote
<mp_identity_t
>;
41 #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1800 )
43 using R1
= Y
<Q::fn
, void, char, int>;
44 BOOST_TEST_TRAIT_TRUE((std::is_same
<R1
, X
<void, char, int>>));
47 #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1920 && BOOST_MSVC >= 1900 )
49 using R2
= Z
<Q
, void, char, int>;
50 BOOST_TEST_TRAIT_TRUE((std::is_same
<R2
, X
<void, char, int>>));
55 using Q
= mp_quote
<P
>;
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[]>>));
62 using Q
= mp_quote
<first
>;
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[]>));
68 return boost::report_errors();