util/{Const,Writable}Buffer: add method SetEnd()
This commit is contained in:
parent
4f2163e76c
commit
855750c784
@ -289,6 +289,19 @@ struct ConstBuffer {
|
|||||||
size = end() - new_data;
|
size = end() - new_data;
|
||||||
data = new_data;
|
data = new_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the end pointer to the given address (by adjusting the
|
||||||
|
* size).
|
||||||
|
*/
|
||||||
|
void SetEnd(pointer_type new_end) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
assert(IsNull() == (new_end == nullptr));
|
||||||
|
assert(new_end >= begin());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
size = new_end - data;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -278,6 +278,19 @@ struct WritableBuffer {
|
|||||||
size = end() - new_data;
|
size = end() - new_data;
|
||||||
data = new_data;
|
data = new_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the end pointer to the given address (by adjusting the
|
||||||
|
* size).
|
||||||
|
*/
|
||||||
|
void SetEnd(pointer_type new_end) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
assert(IsNull() == (new_end == nullptr));
|
||||||
|
assert(new_end >= begin());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
size = new_end - data;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user