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 BOOST_QVM_185557CE385511E780ACD7B781262D2E
7 #define BOOST_QVM_185557CE385511E780ACD7B781262D2E
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
14 boost
15     {
16     namespace
17     qvm
18         {
19         namespace
20         qvm_detail
21             {
22             template <int D>
23             struct
24             assign_vv_defined
25                 {
26                 static bool const value=false;
27                 };
28 
29             template <int I,int N>
30             struct
31             copy_vector_elements
32                 {
33                 template <class A,class B>
34                 static
35                 void
fboost::qvm::qvm_detail::copy_vector_elements36                 f( A & a, B const & b )
37                     {
38                     vec_traits<A>::template write_element<I>(a)=vec_traits<B>::template read_element<I>(b);
39                     copy_vector_elements<I+1,N>::f(a,b);
40                     }
41                 };
42 
43             template <int N>
44             struct
45             copy_vector_elements<N,N>
46                 {
47                 template <class A,class B>
48                 static
49                 void
fboost::qvm::qvm_detail::copy_vector_elements50                 f( A &, B const & )
51                     {
52                     }
53                 };
54             }
55 
56         template <class A,class B>
57         inline
58         typename boost::enable_if_c<
59             is_vec<A>::value && is_vec<B>::value &&
60             vec_traits<A>::dim==vec_traits<B>::dim &&
61             !qvm_detail::assign_vv_defined<vec_traits<A>::dim>::value,
62             A &>::type
assign(A & a,B const & b)63         assign( A & a, B const & b )
64             {
65             qvm_detail::copy_vector_elements<0,vec_traits<A>::dim>::f(a,b);
66             return a;
67             }
68         }
69     }
70 
71 #endif
72