matrix: add begin/end family of methods
This commit is contained in:
parent
b809925396
commit
43b59c6801
10
matrix.hpp
10
matrix.hpp
@ -30,9 +30,19 @@ namespace util {
|
||||
static const size_t rows = S;
|
||||
static const size_t cols = S;
|
||||
|
||||
// index operators return a pointer into the data array so that
|
||||
// multidimensional array syntax can be used transparently on this
|
||||
// type.
|
||||
T* operator[] (size_t);
|
||||
const T* operator[] (size_t) const;
|
||||
|
||||
const T* begin (void) const;
|
||||
const T* end (void) const;
|
||||
T* begin (void);
|
||||
T* end (void);
|
||||
const T* cbegin (void) const;
|
||||
const T* cend (void) const;
|
||||
|
||||
matrix& transpose (void);
|
||||
matrix transposed (void) const;
|
||||
|
||||
|
72
matrix.ipp
72
matrix.ipp
@ -39,25 +39,59 @@ util::matrix<S,T>::operator[] (size_t idx) const
|
||||
return this->values[idx];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//template <size_t S, typename T>
|
||||
//vector<3,T>
|
||||
//matrix<S,T>::operator* (vector<3,T> v) const
|
||||
//{
|
||||
// return (
|
||||
// *this * v.template homog<S> ()
|
||||
// ).template redim<3> ();
|
||||
//}
|
||||
//
|
||||
//
|
||||
////-----------------------------------------------------------------------------
|
||||
//template <size_t S, typename T>
|
||||
//point<3,T>
|
||||
//matrix<S,T>::operator* (point<3,T> p) const
|
||||
//{
|
||||
// return (*this * p.template homog<S> ()).template redim<3> ();
|
||||
//}
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
const T*
|
||||
util::matrix<S,T>::begin (void) const
|
||||
{
|
||||
return &(*this)[0][0];
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
const T*
|
||||
util::matrix<S,T>::end (void) const
|
||||
{
|
||||
return &(*this)[S][0];
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
const T*
|
||||
util::matrix<S,T>::cbegin (void) const
|
||||
{
|
||||
return begin ();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
const T*
|
||||
util::matrix<S,T>::cend (void) const
|
||||
{
|
||||
return end ();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
T*
|
||||
util::matrix<S,T>::begin (void)
|
||||
{
|
||||
return &(*this)[0][0];
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
T*
|
||||
util::matrix<S,T>::end (void)
|
||||
{
|
||||
return &(*this)[S][0];
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user