range fixes

master
Daniel Kolesa 2015-05-08 02:03:48 +01:00
parent ff9c78c1d4
commit 6a8dec424a
1 changed files with 13 additions and 1 deletions

View File

@ -280,9 +280,12 @@ namespace octa {
return MoveRange<T>(p_range.slice(start, end));
}
void put(r_val &v) noexcept(noexcept(p_range.put(v))) {
void put(const r_val &v) noexcept(noexcept(p_range.put(v))) {
p_range.put(v);
}
void put(r_val &&v) noexcept(noexcept(p_range.put(move(v)))) {
p_range.put(move(v));
}
};
template<typename T>
@ -334,6 +337,12 @@ namespace octa {
PointerRange(T *beg, T *end) noexcept: p_beg(beg), p_end(end) {}
PointerRange(T *beg, size_t n) noexcept: p_beg(beg), p_end(beg + n) {}
PointerRange &operator=(const PointerRange &v) noexcept {
p_beg = v.p_beg;
p_end = v.p_end;
return *this;
}
bool operator==(const PointerRange &v) const noexcept {
return p_beg == v.p_beg && p_end == v.p_end;
}
@ -375,6 +384,9 @@ namespace octa {
void put(const T &v) noexcept(IsNothrowCopyAssignable<T>::value) {
*(p_beg++) = v;
}
void put(T &&v) noexcept(IsNothrowMoveAssignable<T>::value) {
*(p_beg++) = move(v);
}
private:
T *p_beg, *p_end;