]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/qvm/detail/vec_assign.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / qvm / detail / vec_assign.hpp
1 #ifndef BOOST_QVM_DETAIL_VEC_ASSIGN_HPP_INCLUDED
2 #define BOOST_QVM_DETAIL_VEC_ASSIGN_HPP_INCLUDED
3
4 // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.
5
6 // Distributed under the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
9 #include <boost/qvm/gen/vec_assign2.hpp>
10 #include <boost/qvm/gen/vec_assign3.hpp>
11 #include <boost/qvm/gen/vec_assign4.hpp>
12
13 namespace boost { namespace qvm {
14
15 namespace
16 qvm_detail
17 {
18 template <int D>
19 struct
20 assign_vv_defined
21 {
22 static bool const value=false;
23 };
24
25 template <int I,int N>
26 struct
27 copy_vector_elements
28 {
29 template <class A,class B>
30 static
31 void
32 f( A & a, B const & b )
33 {
34 vec_traits<A>::template write_element<I>(a)=vec_traits<B>::template read_element<I>(b);
35 copy_vector_elements<I+1,N>::f(a,b);
36 }
37 };
38
39 template <int N>
40 struct
41 copy_vector_elements<N,N>
42 {
43 template <class A,class B>
44 static
45 void
46 f( A &, B const & )
47 {
48 }
49 };
50 }
51
52 template <class A,class B>
53 inline
54 typename enable_if_c<
55 is_vec<A>::value && is_vec<B>::value &&
56 vec_traits<A>::dim==vec_traits<B>::dim &&
57 !qvm_detail::assign_vv_defined<vec_traits<A>::dim>::value,
58 A &>::type
59 assign( A & a, B const & b )
60 {
61 qvm_detail::copy_vector_elements<0,vec_traits<A>::dim>::f(a,b);
62 return a;
63 }
64
65 } }
66
67 #endif