1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
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)
6 #ifndef UUID_DFFD61ACC72311E6955FFF1F07624D53
7 #define UUID_DFFD61ACC72311E6955FFF1F07624D53
9 #include <boost/qvm/inline.hpp>
10 #include <boost/qvm/assert.hpp>
24 template <int I,int N>
30 BOOST_QVM_INLINE_CRITICAL
31 typename vec_traits<A>::scalar_type &
32 write_element_idx( int i, A & a )
35 vec_traits<A>::template write_element<I>(a) :
36 vector_w<I+1,N>::write_element_idx(i,a);
46 BOOST_QVM_INLINE_TRIVIAL
47 typename vec_traits<A>::scalar_type &
48 write_element_idx( int, A & a )
51 return vec_traits<A>::template write_element<0>(a);
56 template <class VecType,class ScalarType,int Dim>
60 typedef VecType vec_type;
61 typedef ScalarType scalar_type;
62 static int const dim=Dim;
66 BOOST_QVM_INLINE_CRITICAL
68 read_element( vec_type const & x )
70 return vec_traits<vec_type>::template write_element<I>(const_cast<vec_type &>(x));
74 BOOST_QVM_INLINE_CRITICAL
76 read_element_idx( int i, vec_type const & x )
78 return vec_traits<vec_type>::write_element_idx(i,const_cast<vec_type &>(x));
84 BOOST_QVM_INLINE_TRIVIAL
86 write_element_idx( int i, vec_type & m )
88 return qvm_detail::vector_w<0,vec_traits<vec_type>::dim>::write_element_idx(i,m);