]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/include/boost/qvm/deduce_vec.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / qvm / include / boost / qvm / deduce_vec.hpp
1 //Copyright (c) 2008-2016 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 #ifndef UUID_7E7AB138196311E0907B246CDFD72085
7 #define UUID_7E7AB138196311E0907B246CDFD72085
8
9 #include <boost/qvm/deduce_scalar.hpp>
10 #include <boost/qvm/vec_traits.hpp>
11 #include <boost/qvm/static_assert.hpp>
12
13 namespace
14 boost
15 {
16 namespace
17 qvm
18 {
19 template <class T,int D>
20 struct vec;
21
22 namespace
23 qvm_detail
24 {
25 template <class V,int D,
26 int VD=vec_traits<V>::dim>
27 struct
28 deduce_vec_default
29 {
30 typedef vec<typename vec_traits<V>::scalar_type,D> type;
31 };
32
33 template <class V,int D>
34 struct
35 deduce_vec_default<V,D,D>
36 {
37 typedef V type;
38 };
39 }
40
41 template <class V,int Dim=vec_traits<V>::dim>
42 struct
43 deduce_vec
44 {
45 BOOST_QVM_STATIC_ASSERT(is_vec<V>::value);
46 typedef typename qvm_detail::deduce_vec_default<V,Dim>::type type;
47 };
48
49 namespace
50 qvm_detail
51 {
52 template <class A,class B,int D,
53 bool VA=is_vec<A>::value,
54 bool VB=is_vec<B>::value,
55 int AD=vec_traits<A>::dim,
56 int BD=vec_traits<B>::dim>
57 struct
58 deduce_v2_default
59 {
60 typedef vec<
61 typename deduce_scalar<
62 typename scalar<A>::type,
63 typename scalar<B>::type>::type,
64 D> type;
65 };
66
67 template <class V,int D>
68 struct
69 deduce_v2_default<V,V,D,true,true,D,D>
70 {
71 typedef V type;
72 };
73 }
74
75 template <class A,class B,int D>
76 struct
77 deduce_vec2
78 {
79 BOOST_QVM_STATIC_ASSERT(is_vec<A>::value || is_vec<B>::value);
80 typedef typename qvm_detail::deduce_v2_default<A,B,D>::type type;
81 };
82 }
83 }
84
85 #endif