Lines Matching refs:Slice
31 // Slice represents memory as a half-closed interval [base, limit).
33 // Note that without manually invoking the Slice() constructor, it is
38 // Note that const Slice still wraps mutable memory, however copy
40 class Slice {
42 Slice() = default;
45 Slice(void* base, void* limit) : mBase(toUint8(base)), mLimit(toUint8(limit)) {}
48 Slice(void* base, size_t size) : Slice(base, toUint8(base) + size) {}
71 inline const Slice makeSlice(const T& ref) {
78 inline const Slice makeSlice(const std::string& s) {
85 inline const Slice makeSlice(const std::vector<T>& v) {
91 inline const Slice makeSlice(const std::array<U, V>& a) {
95 // Return prefix and suffix of Slice s ending and starting at position cut
96 inline std::pair<const Slice, const Slice> split(const Slice s, size_t cut) {
101 // Return prefix of Slice s ending at position cut
102 inline const Slice take(const Slice s, size_t cut) {
106 // Return suffix of Slice s starting at position cut
107 inline const Slice drop(const Slice s, size_t cut) {
112 inline size_t copy(const Slice dst, const Slice src) {
120 inline size_t extract(const Slice src, Head& head) {
128 inline size_t extract(const Slice src, Head& head, Tail... tail) {
134 std::string toString(const Slice s);
138 std::string toHex(const Slice s, int wrap);
140 inline bool operator==(const Slice& lhs, const Slice& rhs) {
144 inline bool operator!=(const Slice& lhs, const Slice& rhs) {
148 std::ostream& operator<<(std::ostream& os, const Slice& slice);