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
13namespace boost { namespace qvm {
14
15namespace
16qvm_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 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
32 typename enable_if_c<
33 vec_write_element_ref<A>::value,
34 void>::type
35 f( A & a, B const & b )
36 {
37 vec_traits<A>::template write_element<I>(a) = vec_traits<B>::template read_element<I>(b);
38 copy_vector_elements<I+1,N>::f(a,b);
39 }
40
41 template <class A,class B>
42 static
43 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
44 typename enable_if_c<
45 !vec_write_element_ref<A>::value,
46 void>::type
47 f( A & a, B const & b )
48 {
49 vec_traits<A>::template write_element<I>(a, vec_traits<B>::template read_element<I>(b));
50 copy_vector_elements<I+1,N>::f(a,b);
51 }
52 };
53
54 template <int N>
55 struct
56 copy_vector_elements<N,N>
57 {
58 template <class A,class B>
59 static
60 void
61 f( A &, B const & )
62 {
63 }
64 };
65 }
66
67template <class A,class B>
68inline
69typename enable_if_c<
70 is_vec<A>::value && is_vec<B>::value &&
71 vec_traits<A>::dim==vec_traits<B>::dim &&
72 !qvm_detail::assign_vv_defined<vec_traits<A>::dim>::value,
73 A &>::type
74assign( A & a, B const & b )
75 {
76 qvm_detail::copy_vector_elements<0,vec_traits<A>::dim>::f(a,b);
77 return a;
78 }
79
80} }
81
82#endif
83

source code of boost/libs/qvm/include/boost/qvm/detail/vec_assign.hpp