]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | #ifndef BOOST_QVM_DETAIL_VEC_ASSIGN_HPP_INCLUDED |
2 | #define BOOST_QVM_DETAIL_VEC_ASSIGN_HPP_INCLUDED | |
92f5a8d4 | 3 | |
1e59de90 | 4 | // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. |
92f5a8d4 | 5 | |
1e59de90 TL |
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) | |
92f5a8d4 TL |
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 | ||
1e59de90 TL |
13 | namespace boost { namespace qvm { |
14 | ||
92f5a8d4 | 15 | namespace |
1e59de90 | 16 | qvm_detail |
92f5a8d4 | 17 | { |
1e59de90 TL |
18 | template <int D> |
19 | struct | |
20 | assign_vv_defined | |
92f5a8d4 | 21 | { |
1e59de90 TL |
22 | static bool const value=false; |
23 | }; | |
92f5a8d4 | 24 | |
1e59de90 TL |
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); | |
92f5a8d4 | 36 | } |
1e59de90 | 37 | }; |
92f5a8d4 | 38 | |
1e59de90 TL |
39 | template <int N> |
40 | struct | |
41 | copy_vector_elements<N,N> | |
42 | { | |
92f5a8d4 | 43 | template <class A,class B> |
1e59de90 TL |
44 | static |
45 | void | |
46 | f( A &, B const & ) | |
92f5a8d4 | 47 | { |
92f5a8d4 | 48 | } |
1e59de90 | 49 | }; |
92f5a8d4 TL |
50 | } |
51 | ||
1e59de90 TL |
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 | ||
92f5a8d4 | 67 | #endif |