liuxiaolong
2021-07-20 58d904a328c0d849769b483e901a0be9426b8209
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
//Copyright (c) 2008-2016 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)
 
#ifndef BOOST_QVM_185557CE385511E780ACD7B781262D2E
#define BOOST_QVM_185557CE385511E780ACD7B781262D2E
 
#include <boost/qvm/gen/vec_assign2.hpp>
#include <boost/qvm/gen/vec_assign3.hpp>
#include <boost/qvm/gen/vec_assign4.hpp>
 
namespace
boost
    {
    namespace
    qvm
        {
        namespace
        qvm_detail
            {
            template <int D>
            struct
            assign_vv_defined
                {
                static bool const value=false;
                };
 
            template <int I,int N>
            struct
            copy_vector_elements
                {
                template <class A,class B>
                static
                void
                f( A & a, B const & b )
                    {
                    vec_traits<A>::template write_element<I>(a)=vec_traits<B>::template read_element<I>(b);
                    copy_vector_elements<I+1,N>::f(a,b);
                    }
                };
 
            template <int N>
            struct
            copy_vector_elements<N,N>
                {
                template <class A,class B>
                static
                void
                f( A &, B const & )
                    {
                    }
                };
            }
 
        template <class A,class B>
        inline
        typename boost::enable_if_c<
            is_vec<A>::value && is_vec<B>::value &&
            vec_traits<A>::dim==vec_traits<B>::dim &&
            !qvm_detail::assign_vv_defined<vec_traits<A>::dim>::value,
            A &>::type
        assign( A & a, B const & b )
            {
            qvm_detail::copy_vector_elements<0,vec_traits<A>::dim>::f(a,b);
            return a;
            }
        }
    }
 
#endif