]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/qvm/scalar_traits.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / qvm / scalar_traits.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_57E1C032B9F311DEB7D9BAFE55D89593
7 #define UUID_57E1C032B9F311DEB7D9BAFE55D89593
8
9 #include <boost/qvm/quat_traits.hpp>
10 #include <boost/qvm/vec_traits.hpp>
11 #include <boost/qvm/mat_traits.hpp>
12 #include <boost/qvm/inline.hpp>
13
14 namespace
15 boost
16 {
17 namespace
18 qvm
19 {
20 template <class Scalar>
21 struct
22 scalar_traits
23 {
24 static
25 BOOST_QVM_INLINE_CRITICAL
26 Scalar
27 value( int v )
28 {
29 return Scalar(v);
30 }
31 };
32
33 template <class T>
34 struct
35 is_scalar
36 {
37 static bool const value=false;
38 };
39 template <> struct is_scalar<char> { static bool const value=true; };
40 template <> struct is_scalar<signed char> { static bool const value=true; };
41 template <> struct is_scalar<unsigned char> { static bool const value=true; };
42 template <> struct is_scalar<signed short> { static bool const value=true; };
43 template <> struct is_scalar<unsigned short> { static bool const value=true; };
44 template <> struct is_scalar<signed int> { static bool const value=true; };
45 template <> struct is_scalar<unsigned int> { static bool const value=true; };
46 template <> struct is_scalar<signed long> { static bool const value=true; };
47 template <> struct is_scalar<unsigned long> { static bool const value=true; };
48 template <> struct is_scalar<float> { static bool const value=true; };
49 template <> struct is_scalar<double> { static bool const value=true; };
50 template <> struct is_scalar<long double> { static bool const value=true; };
51
52 namespace
53 qvm_detail
54 {
55 template <class A,bool M=is_mat<A>::value,bool Q=is_quat<A>::value,bool V=is_vec<A>::value>
56 struct
57 scalar_impl
58 {
59 };
60
61 template <class A>
62 struct
63 scalar_impl<A,true,false,false>
64 {
65 typedef typename mat_traits<A>::scalar_type type;
66 };
67
68 template <class A>
69 struct
70 scalar_impl<A,false,true,false>
71 {
72 typedef typename quat_traits<A>::scalar_type type;
73 };
74
75 template <class A>
76 struct
77 scalar_impl<A,false,false,true>
78 {
79 typedef typename vec_traits<A>::scalar_type type;
80 };
81 }
82
83 template <class A>
84 struct
85 scalar
86 {
87 typedef typename qvm_detail::scalar_impl<A>::type type;
88 };
89 }
90 }
91
92 #endif