fix get_n

master
Daniel Kolesa 2015-07-01 22:26:56 +01:00
parent 98decde76a
commit dd157f8be8
1 changed files with 8 additions and 2 deletions

View File

@ -466,14 +466,20 @@ template<typename B, typename C, typename V, typename R = V &,
>> Size get_n(OR orange, Size n = -1) {
B &r = *((B *)this);
Size on = n;
for (; n && !r.empty() && orange.put(r.front()); --n);
for (; n && !r.empty(); --n) {
orange.put(r.front());
r.pop_front();
}
return (on - n);
}
Size get_n(octa::RemoveCv<Value> *p, Size n = -1) {
B &r = *((B *)this);
Size on = n;
for (; n && !r.empty(); --n) *p++ = r.front();
for (; n && !r.empty(); --n) {
*p++ = r.front();
r.pop_front();
}
return (on - n);
}
};