vector: add cast operator
This commit is contained in:
parent
ec9b8a0c57
commit
a67edcde1a
@ -52,6 +52,8 @@ namespace util {
|
||||
// constants
|
||||
static const vector<S,T> ZERO;
|
||||
|
||||
template<typename U> vector<S,U> cast (void) const;
|
||||
|
||||
void sanity (void) const;
|
||||
};
|
||||
|
||||
|
14
vector.ipp
14
vector.ipp
@ -74,4 +74,18 @@ namespace util {
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
template <typename U>
|
||||
vector<S,U>
|
||||
vector<S,T>::cast (void) const
|
||||
{
|
||||
vector<S,U> out;
|
||||
std::copy (std::begin (this->data),
|
||||
std::end (this->data),
|
||||
std::begin (out.data));
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user