point: add a cast method
This commit is contained in:
parent
d3f098216c
commit
2210db9c4e
@ -63,6 +63,8 @@ namespace util {
|
|||||||
|
|
||||||
static const point<S,T> ORIGIN;
|
static const point<S,T> ORIGIN;
|
||||||
|
|
||||||
|
template<typename U> point<S,U> cast (void) const;
|
||||||
|
|
||||||
void sanity (void) const;
|
void sanity (void) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
14
point.ipp
14
point.ipp
@ -93,4 +93,18 @@ namespace util {
|
|||||||
out.data + L1);
|
out.data + L1);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
template <size_t S, typename T>
|
||||||
|
template <typename U>
|
||||||
|
point<S,U>
|
||||||
|
point<S,T>::cast (void) const
|
||||||
|
{
|
||||||
|
point<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