]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/test/common_type_5_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / type_traits / test / common_type_5_test.cpp
CommitLineData
7c673cae
FG
1
2// Copyright Peter Dimov 2015
3// Use, modification and distribution are subject to the
4// Boost Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.tt.org/LICENSE_1_0.txt)
6
7c673cae
FG
7#ifdef TEST_STD
8# include <type_traits>
9#else
10# include <boost/type_traits/common_type.hpp>
11#endif
11fdf7f2
TL
12#include "test.hpp"
13#include "check_type.hpp"
7c673cae
FG
14#include <iostream>
15
16template<class T> struct X
17{
18 T t_;
19
1e59de90
TL
20 BOOST_TT_PROC X(): t_() {}
21 template<class U> BOOST_TT_PROC X( X<U> const & x ): t_( x.t_ ) {}
7c673cae
FG
22};
23
24namespace boost
25{
26
27 template<class T, class U> struct common_type< X<T>, X<U> >
28 {
29 typedef X<typename common_type<T, U>::type> type;
30 };
31
32} // namespace boost
33
34TT_TEST_BEGIN(common_type_5)
35{
36 // user specializations, binary
37
38 BOOST_CHECK_TYPE3( tt::common_type< X<char>, X<char> >::type, X<char> );
39
40 BOOST_CHECK_TYPE3( tt::common_type< X<char>&, X<char>& >::type, X<char> );
41 BOOST_CHECK_TYPE3( tt::common_type< X<char>&, X<char> const& >::type, X<char> );
42 BOOST_CHECK_TYPE3( tt::common_type< X<char> const&, X<char>& >::type, X<char> );
43 BOOST_CHECK_TYPE3( tt::common_type< X<char> const&, X<char> const& >::type, X<char> );
44
45 BOOST_CHECK_TYPE3( tt::common_type< X<char>, X<unsigned char> >::type, X<int> );
46
47 BOOST_CHECK_TYPE3( tt::common_type< X<char>&, X<unsigned char>& >::type, X<int> );
48 BOOST_CHECK_TYPE3( tt::common_type< X<char>&, X<unsigned char> const& >::type, X<int> );
49 BOOST_CHECK_TYPE3( tt::common_type< X<char> const&, X<unsigned char>& >::type, X<int> );
50 BOOST_CHECK_TYPE3( tt::common_type< X<char> const&, X<unsigned char> const& >::type, X<int> );
51
52 // ternary
53
54 BOOST_CHECK_TYPE4( tt::common_type< X<char>&, X<long> const&, X<short> volatile& >::type, X<long> );
55}
56TT_TEST_END