util/ConstBuffer: add method MoveFront()
This commit is contained in:
parent
27a40a9843
commit
438b7b7bd0
@ -246,6 +246,20 @@ struct ConstBuffer {
|
||||
data += n;
|
||||
size -= n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the front pointer to the given address, and adjust the
|
||||
* size attribute to retain the old end address.
|
||||
*/
|
||||
void MoveFront(pointer_type new_data) {
|
||||
#ifndef NDEBUG
|
||||
assert(IsNull() == (new_data == nullptr));
|
||||
assert(new_data <= end());
|
||||
#endif
|
||||
|
||||
size = end() - new_data;
|
||||
data = new_data;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user