1
0
Fork 0

Add set method for Slice in velocypack.

This commit is contained in:
Max Neunhoeffer 2016-02-23 13:42:57 +01:00
parent 4d9c132a0a
commit 7c890dce03
1 changed files with 4 additions and 8 deletions

View File

@ -95,6 +95,9 @@ class Slice {
// pointer to the head byte
uint8_t const* start() const { return _start; }
// Set new memory position
void set(uint8_t const* s) { _start = s; }
// pointer to the head byte
template <typename T>
T const* startAs() const {
@ -660,6 +663,7 @@ class Slice {
// check if two Slices are equal on the binary level
bool equals(Slice const& other) const;
bool operator==(Slice const& other) const { return equals(other); }
static bool equals(uint8_t const* left, uint8_t const* right) {
return Slice(left).equals(Slice(right));
@ -775,14 +779,6 @@ struct hash<arangodb::velocypack::Slice> {
}
};
// implementation of std::equal_to for two Slice objects
template <>
struct equal_to<arangodb::velocypack::Slice> {
bool operator()(arangodb::velocypack::Slice const& left,
arangodb::velocypack::Slice const& right) const {
return left.equals(right);
}
};
}
std::ostream& operator<<(std::ostream&, arangodb::velocypack::Slice const*);