]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/deduce_quat_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / qvm / test / deduce_quat_test.cpp
1 // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.
2
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifdef BOOST_QVM_TEST_SINGLE_HEADER
7 # include BOOST_QVM_TEST_SINGLE_HEADER
8 #else
9 # include <boost/qvm/deduce_quat.hpp>
10 #endif
11
12 template <class T,class U>
13 struct same_type;
14
15 template <class T>
16 struct
17 same_type<T,T>
18 {
19 };
20
21 template <class A,class B,class Result>
22 struct
23 check
24 {
25 same_type<typename boost::qvm::deduce_quat2<A,B>::type,Result> a;
26 same_type<typename boost::qvm::deduce_quat2<B,A>::type,Result> b;
27 };
28
29 template <class T> struct q1;
30 template <class T> struct q2;
31
32 namespace
33 boost
34 {
35 namespace
36 qvm
37 {
38 template <class T>
39 struct
40 quat_traits< q1<T> >
41 {
42 typedef T scalar_type;
43 };
44
45 template <class T>
46 struct
47 quat_traits< q2<T> >
48 {
49 typedef T scalar_type;
50 };
51
52 template <class S,class Q2S>
53 struct
54 deduce_quat<q2<Q2S>,S>
55 {
56 typedef q2<S> type;
57 };
58
59 template <class S,class AS,class BS>
60 struct
61 deduce_quat2<q2<AS>,q2<BS>,S>
62 {
63 typedef q2<S> type;
64 };
65 }
66 }
67
68 int
69 main()
70 {
71 same_type< boost::qvm::deduce_quat< q1<int> >::type, q1<int> >();
72 check< q1<int>, q1<int>, q1<int> >();
73
74 same_type< boost::qvm::deduce_quat< q2<int> >::type, q2<int> >();
75 same_type< boost::qvm::deduce_quat< q2<int> >::type, q2<int> >();
76 check< q2<int>, q2<int>, q2<int> >();
77 check< q2<int>, q2<float>, q2<float> >();
78 }