]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/metaparse/test/swap.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / metaparse / test / swap.cpp
1 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6 #include <boost/metaparse/v1/swap.hpp>
7
8 #include <boost/type_traits/is_same.hpp>
9
10 #include <boost/mpl/assert.hpp>
11
12 #include "test_case.hpp"
13
14 namespace
15 {
16 struct returns_first
17 {
18 typedef returns_first type;
19
20 template <class A, class>
21 struct apply
22 {
23 typedef A type;
24 };
25 };
26
27 struct returns_second
28 {
29 typedef returns_second type;
30
31 template <class, class B>
32 struct apply
33 {
34 typedef B type;
35 };
36 };
37 }
38
39 BOOST_METAPARSE_TEST_CASE(swap)
40 {
41 using boost::metaparse::v1::swap;
42 using boost::is_same;
43
44 BOOST_MPL_ASSERT((
45 is_same<double, swap<returns_first>::apply<int, double>::type>
46 ));
47
48 BOOST_MPL_ASSERT((
49 is_same<int, swap<returns_second>::apply<int, double>::type>
50 ));
51 }
52