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 BOOST_QVM_DEC6035EA1C211DEA5E8ECB856D89593
7 #define BOOST_QVM_DEC6035EA1C211DEA5E8ECB856D89593
9 #include <boost/qvm/inline.hpp>
10 #include <boost/qvm/deduce_vec.hpp>
11 #include <boost/qvm/detail/remove_const.hpp>
12 #include <boost/qvm/assert.hpp>
20 template <class T,int M,int N>
24 static int const dim=0;
25 typedef void scalar_type;
28 template <class T,int Dim>
32 typedef T this_vector[Dim];
33 typedef typename qvm_detail::remove_const<T>::type scalar_type;
34 static int const dim=Dim;
38 BOOST_QVM_INLINE_CRITICAL
40 read_element( this_vector const & x )
42 BOOST_QVM_STATIC_ASSERT(I>=0);
43 BOOST_QVM_STATIC_ASSERT(I<Dim);
49 BOOST_QVM_INLINE_CRITICAL
51 write_element( this_vector & x )
53 BOOST_QVM_STATIC_ASSERT(I>=0);
54 BOOST_QVM_STATIC_ASSERT(I<Dim);
59 BOOST_QVM_INLINE_CRITICAL
61 read_element_idx( int i, this_vector const & x )
63 BOOST_QVM_ASSERT(i>=0);
64 BOOST_QVM_ASSERT(i<Dim);
69 BOOST_QVM_INLINE_CRITICAL
71 write_element_idx( int i, this_vector & x )
73 BOOST_QVM_ASSERT(i>=0);
74 BOOST_QVM_ASSERT(i<Dim);
79 template <class T,int Dim,int D>
83 typedef vec<T,D> type;
86 template <class T,int Dim,int D>
88 deduce_vec<T const[Dim],D>
90 typedef vec<T,D> type;
93 template <class T1,class T2,int Dim,int D>
95 deduce_vec2<T1[Dim],T2[Dim],D>
97 typedef vec<typename deduce_scalar<T1,T2>::type,D> type;
100 template <int Dim,class T>
101 T (&ptr_vref( T * ptr ))[Dim]
103 return *reinterpret_cast<T (*)[Dim]>(ptr);