Blame view

3rdparty/boost_1_81_0/boost/qvm/scalar_traits.hpp 1.63 KB
0b6a182c   Hu Chunming   添加无鉴权注册和注销
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  #ifndef BOOST_QVM_SCALAR_TRAITS_HPP_INCLUDED
  #define BOOST_QVM_SCALAR_TRAITS_HPP_INCLUDED
  
  // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.
  
  // Distributed under the Boost Software License, Version 1.0. (See accompanying
  // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  
  #include <boost/qvm/quat_traits.hpp>
  #include <boost/qvm/vec_traits.hpp>
  #include <boost/qvm/mat_traits.hpp>
  #include <boost/qvm/config.hpp>
  
  namespace boost { namespace qvm {
  
  template <class Scalar>
  struct
  scalar_traits
      {
      static
      BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
      Scalar
      value( int v )
          {
          return Scalar(v);
          }
      };
  
  namespace
  qvm_detail
      {
      template <class A,
          bool IsQ=is_quat<A>::value,
          bool IsV=is_vec<A>::value,
          bool IsM=is_mat<A>::value,
          bool IsS=is_scalar<A>::value>
      struct
      scalar_impl
          {
          typedef void type;
          };
  
      template <class A>
      struct
      scalar_impl<A,false,false,false,true>
          {
          typedef A type;
          };
  
      template <class A>
      struct
      scalar_impl<A,false,false,true,false>
          {
          typedef typename mat_traits<A>::scalar_type type;
          };
  
      template <class A>
      struct
      scalar_impl<A,false,true,false,false>
          {
          typedef typename vec_traits<A>::scalar_type type;
          };
  
      template <class A>
      struct
      scalar_impl<A,true,false,false,false>
          {
          typedef typename quat_traits<A>::scalar_type type;
          };
      }
  
  template <class A>
  struct
  scalar
      {
      typedef typename qvm_detail::scalar_impl<A>::type type;
      };
  
  } }
  
  #endif