c/base: add convenience type conversion operator

This commit is contained in:
Danny Robson 2015-03-11 22:58:14 +11:00
parent 4e3d67185c
commit 5d9c2b1696

View File

@ -56,6 +56,15 @@ namespace util { namespace coord {
T* begin (void) { return std::begin (this->data); } T* begin (void) { return std::begin (this->data); }
T* end (void) { return std::end (this->data); } T* end (void) { return std::end (this->data); }
// conversions
template <template <size_t, typename> class K>
K<S,T> as (void) const
{
K<S,T> k;
std::copy (begin (), end (), k.begin ());
return k;
}
}; };
} } } }