coord: prefer cbegin/cend where possible

This commit is contained in:
Danny Robson 2017-06-13 14:18:00 +10:00
parent a59f6ffc69
commit ae40b163e5

View File

@ -87,8 +87,8 @@ namespace util::coord {
cast (void) const cast (void) const
{ {
KLASS<S,U> out; KLASS<S,U> out;
std::copy (std::begin (this->data), std::copy (std::cbegin (this->data),
std::end (this->data), std::cend (this->data),
std::begin (out.data)); std::begin (out.data));
return out; return out;
} }
@ -100,7 +100,7 @@ namespace util::coord {
redim (void) const redim (void) const
{ {
KLASS<D,T> out; KLASS<D,T> out;
std::copy_n (std::begin (this->data), std::copy_n (std::cbegin (this->data),
min (S, D), min (S, D),
std::begin (out.data)); std::begin (out.data));
return out; return out;
@ -117,7 +117,7 @@ namespace util::coord {
static constexpr auto L1 = min (S, D); static constexpr auto L1 = min (S, D);
static constexpr auto L2 = D - L1; static constexpr auto L2 = D - L1;
std::copy_n (std::begin (this->data), std::copy_n (std::cbegin (this->data),
L1, L1,
std::begin (out.data)); std::begin (out.data));
@ -134,7 +134,7 @@ namespace util::coord {
{ {
KLASS<D,T> out; KLASS<D,T> out;
auto cursor = std::copy_n (std::begin (this->data), auto cursor = std::copy_n (std::cbegin (this->data),
min (S, D), min (S, D),
std::begin (out.data)); std::begin (out.data));
std::fill (cursor, std::end (out.data), fill); std::fill (cursor, std::end (out.data), fill);