]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_traits/test/common_type_5_test.cpp
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)
8 #include "check_type.hpp"
10 # include <type_traits>
12 # include <boost/type_traits/common_type.hpp>
16 template<class T
> struct X
21 template<class U
> X( X
<U
> const & x
): t_( x
.t_
) {}
27 template<class T
, class U
> struct common_type
< X
<T
>, X
<U
> >
29 typedef X
<typename common_type
<T
, U
>::type
> type
;
34 TT_TEST_BEGIN(common_type_5
)
36 // user specializations, binary
38 BOOST_CHECK_TYPE3( tt::common_type
< X
<char>, X
<char> >::type
, X
<char> );
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> );
45 BOOST_CHECK_TYPE3( tt::common_type
< X
<char>, X
<unsigned char> >::type
, X
<int> );
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> );
54 BOOST_CHECK_TYPE4( tt::common_type
< X
<char>&, X
<long> const&, X
<short> volatile& >::type
, X
<long> );