-//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.\r
-\r
-//Distributed under the Boost Software License, Version 1.0. (See accompanying\r
-//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
-\r
-#ifndef UUID_FB4D5BEAC71B11E68D0EEF1707624D53\r
-#define UUID_FB4D5BEAC71B11E68D0EEF1707624D53\r
-\r
-#include <boost/qvm/inline.hpp>\r
-#include <boost/qvm/assert.hpp>\r
-\r
-namespace\r
-boost\r
- {\r
- namespace\r
- qvm\r
- {\r
- template <class>\r
- struct mat_traits;\r
-\r
- namespace\r
- qvm_detail\r
- {\r
- template <int I,int N>\r
- struct\r
- matrix_w\r
- {\r
- template <class A>\r
- static\r
- BOOST_QVM_INLINE_CRITICAL\r
- typename mat_traits<A>::scalar_type &\r
- write_element_idx( int r, int c, A & a )\r
- {\r
- return (I/mat_traits<A>::cols)==r && (I%mat_traits<A>::cols)==c?\r
- mat_traits<A>::template write_element<I/mat_traits<A>::cols,I%mat_traits<A>::cols>(a) :\r
- matrix_w<I+1,N>::write_element_idx(r,c,a);\r
- }\r
- };\r
-\r
- template <int N>\r
- struct\r
- matrix_w<N,N>\r
- {\r
- template <class A>\r
- static\r
- BOOST_QVM_INLINE_TRIVIAL\r
- typename mat_traits<A>::scalar_type &\r
- write_element_idx( int, int, A & a )\r
- {\r
- BOOST_QVM_ASSERT(0);\r
- return mat_traits<A>::template write_element<0,0>(a);\r
- }\r
- };\r
- }\r
-\r
- template <class MatType,class ScalarType,int Rows,int Cols>\r
- struct\r
- mat_traits_defaults\r
- {\r
- typedef MatType mat_type;\r
- typedef ScalarType scalar_type;\r
- static int const rows=Rows;\r
- static int const cols=Cols;\r
-\r
- template <int Row,int Col>\r
- static\r
- BOOST_QVM_INLINE_CRITICAL\r
- scalar_type\r
- read_element( mat_type const & x )\r
- {\r
- return mat_traits<mat_type>::template write_element<Row,Col>(const_cast<mat_type &>(x));\r
- }\r
-\r
- static\r
- BOOST_QVM_INLINE_CRITICAL\r
- scalar_type\r
- read_element_idx( int r, int c, mat_type const & x )\r
- {\r
- return mat_traits<mat_type>::write_element_idx(r,c,const_cast<mat_type &>(x));\r
- }\r
-\r
- protected:\r
-\r
- static\r
- BOOST_QVM_INLINE_TRIVIAL\r
- scalar_type &\r
- write_element_idx( int r, int c, mat_type & m )\r
- {\r
- return qvm_detail::matrix_w<0,mat_traits<mat_type>::rows*mat_traits<mat_type>::cols>::write_element_idx(r,c,m);\r
- }\r
- };\r
- }\r
- }\r
-\r
-#endif\r
+//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 UUID_FB4D5BEAC71B11E68D0EEF1707624D53
+#define UUID_FB4D5BEAC71B11E68D0EEF1707624D53
+
+#include <boost/qvm/inline.hpp>
+#include <boost/qvm/assert.hpp>
+
+namespace
+boost
+ {
+ namespace
+ qvm
+ {
+ template <class>
+ struct mat_traits;
+
+ namespace
+ qvm_detail
+ {
+ template <int I,int N>
+ struct
+ matrix_w
+ {
+ template <class A>
+ static
+ BOOST_QVM_INLINE_CRITICAL
+ typename mat_traits<A>::scalar_type &
+ write_element_idx( int r, int c, A & a )
+ {
+ return (I/mat_traits<A>::cols)==r && (I%mat_traits<A>::cols)==c?
+ mat_traits<A>::template write_element<I/mat_traits<A>::cols,I%mat_traits<A>::cols>(a) :
+ matrix_w<I+1,N>::write_element_idx(r,c,a);
+ }
+ };
+
+ template <int N>
+ struct
+ matrix_w<N,N>
+ {
+ template <class A>
+ static
+ BOOST_QVM_INLINE_TRIVIAL
+ typename mat_traits<A>::scalar_type &
+ write_element_idx( int, int, A & a )
+ {
+ BOOST_QVM_ASSERT(0);
+ return mat_traits<A>::template write_element<0,0>(a);
+ }
+ };
+ }
+
+ template <class MatType,class ScalarType,int Rows,int Cols>
+ struct
+ mat_traits_defaults
+ {
+ typedef MatType mat_type;
+ typedef ScalarType scalar_type;
+ static int const rows=Rows;
+ static int const cols=Cols;
+
+ template <int Row,int Col>
+ static
+ BOOST_QVM_INLINE_CRITICAL
+ scalar_type
+ read_element( mat_type const & x )
+ {
+ return mat_traits<mat_type>::template write_element<Row,Col>(const_cast<mat_type &>(x));
+ }
+
+ static
+ BOOST_QVM_INLINE_CRITICAL
+ scalar_type
+ read_element_idx( int r, int c, mat_type const & x )
+ {
+ return mat_traits<mat_type>::write_element_idx(r,c,const_cast<mat_type &>(x));
+ }
+
+ protected:
+
+ static
+ BOOST_QVM_INLINE_TRIVIAL
+ scalar_type &
+ write_element_idx( int r, int c, mat_type & m )
+ {
+ return qvm_detail::matrix_w<0,mat_traits<mat_type>::rows*mat_traits<mat_type>::cols>::write_element_idx(r,c,m);
+ }
+ };
+ }
+ }
+
+#endif