point: add redim with constant
This commit is contained in:
parent
60f2a7e00d
commit
049aaf84c9
@ -59,6 +59,7 @@ namespace util {
|
||||
|
||||
template <size_t D> point<D,T> redim (void) const;
|
||||
template <size_t D> point<D,T> redim (const util::point<D,T> &fill) const;
|
||||
template <size_t D> point<D,T> redim (T fill) const;
|
||||
|
||||
static const point<S,T> ORIGIN;
|
||||
|
||||
|
16
point.ipp
16
point.ipp
@ -95,6 +95,22 @@ namespace util {
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
template <size_t D>
|
||||
point<D,T> point<S,T>::redim (T fill) const
|
||||
{
|
||||
point<D,T> out;
|
||||
|
||||
auto cursor = std::copy_n (std::begin (this->data),
|
||||
min (S, D),
|
||||
std::begin (out.data));
|
||||
std::fill (cursor, std::end (out.data), fill);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <size_t S, typename T>
|
||||
template <typename U>
|
||||
|
Loading…
Reference in New Issue
Block a user