Edit: /usr/include/boost/qvm/mat_traits_defaults.hpp (2914B)
//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_FB4D5BEAC71B11E68D0EEF1707624D53
#define BOOST_QVM_FB4D5BEAC71B11E68D0EEF1707624D53
#include
#include
namespace
boost
{
namespace
qvm
{
template
struct mat_traits;
namespace
qvm_detail
{
template
struct
matrix_w
{
template
static
BOOST_QVM_INLINE_CRITICAL
typename mat_traits::scalar_type &
write_element_idx( int r, int c, A & a )
{
return (I/mat_traits::cols)==r && (I%mat_traits::cols)==c?
mat_traits::template write_element::cols,I%mat_traits::cols>(a) :
matrix_w::write_element_idx(r,c,a);
}
};
template
struct
matrix_w
{
template
static
BOOST_QVM_INLINE_TRIVIAL
typename mat_traits::scalar_type &
write_element_idx( int, int, A & a )
{
BOOST_QVM_ASSERT(0);
return mat_traits::template write_element<0,0>(a);
}
};
}
template
struct
mat_traits_defaults
{
typedef MatType mat_type;
typedef ScalarType scalar_type;
static int const rows=Rows;
static int const cols=Cols;
template
static
BOOST_QVM_INLINE_CRITICAL
scalar_type
read_element( mat_type const & x )
{
return mat_traits::template write_element(const_cast(x));
}
static
BOOST_QVM_INLINE_CRITICAL
scalar_type
read_element_idx( int r, int c, mat_type const & x )
{
return mat_traits::write_element_idx(r,c,const_cast(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::rows*mat_traits::cols>::write_element_idx(r,c,m);
}
};
}
}
#endif