coord/ops: comments

This commit is contained in:
Danny Robson 2015-03-07 03:18:32 +11:00
parent 3f07f6edf7
commit 0ba8b414b4

View File

@ -128,6 +128,7 @@ namespace util {
#undef SCALAR_OP #undef SCALAR_OP
//-------------------------------------------------------------------------
#define SCALAR_OP(OP) \ #define SCALAR_OP(OP) \
template < \ template < \
size_t S, \ size_t S, \
@ -160,6 +161,8 @@ namespace util {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// logic operators // logic operators
/// elementwise equality operator
template < template <
size_t S, size_t S,
typename T, typename T,
@ -173,7 +176,8 @@ namespace util {
std::begin (b)); std::begin (b));
} }
//------------------------------------------------------------------------- ///------------------------------------------------------------------------
/// elementwise inquality operator
template < template <
size_t S, size_t S,
typename T, typename T,
@ -188,6 +192,8 @@ namespace util {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// special operators // special operators
/// point-point subtraction giving a vector difference
template < template <
size_t S, size_t S,
typename T typename T
@ -202,6 +208,17 @@ namespace util {
} }
//-------------------------------------------------------------------------
template <
size_t S,
typename T
>
vector<S,T> operator- (T t, point<S,T> p)
{
return point<S,T> {t} - p;
}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
template < template <
size_t S, size_t S,
@ -217,7 +234,10 @@ namespace util {
return sum; return sum;
} }
//------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////
// logical element operators
/// return a coord type containing the max element at each offset
template < template <
size_t S, size_t S,
typename T, typename T,
@ -233,7 +253,8 @@ namespace util {
} }
//------------------------------------------------------------------------- ///------------------------------------------------------------------------
// /return a coord type containing the max element at each offset
template < template <
size_t S, size_t S,
typename T, typename T,
@ -249,14 +270,16 @@ namespace util {
} }
//------------------------------------------------------------------------- ///------------------------------------------------------------------------
/// return the minimum element of the coordinate type
template <size_t S, typename T, template<size_t,typename> class K> template <size_t S, typename T, template<size_t,typename> class K>
T T
min (K<S,T> k) min (K<S,T> k)
{ return *std::min_element (k.begin (), k.end ()); } { return *std::min_element (k.begin (), k.end ()); }
//------------------------------------------------------------------------- ///------------------------------------------------------------------------
/// return the maximum element of the coordinate type
template <size_t S, typename T, template<size_t,typename> class K> template <size_t S, typename T, template<size_t,typename> class K>
T T
max (K<S,T> k) max (K<S,T> k)