20 #ifndef RIPPLE_BASICS_SLICE_H_INCLUDED
21 #define RIPPLE_BASICS_SLICE_H_INCLUDED
23 #include <ripple/basics/contract.h>
24 #include <ripple/basics/strHex.h>
55 Slice() noexcept = default;
59 operator=(
Slice const&) noexcept = default;
116 Throw<std::domain_error>(
"too small");
194 template <
class Hasher>
204 if (lhs.size() != rhs.size())
210 return std::memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;
216 return !(lhs == rhs);
224 lhs.data() + lhs.size(),
226 rhs.data() + rhs.size());
229 template <
class Stream>
237 template <
class T, std::
size_t N>
246 template <
class T,
class Alloc>
255 template <
class Traits,
class Alloc>
std::size_t size() const noexcept
Returns the number of bytes in the storage.
Slice & operator+=(std::size_t n)
Advance the buffer.
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Slice() noexcept=default
Default constructed Slice has length 0.
const_iterator cend() const noexcept
An immutable linear range of bytes.
Slice operator+(std::size_t n) const
const_iterator end() const noexcept
std::uint8_t const * data_
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
Slice substr(std::size_t pos, std::size_t count=std::numeric_limits< std::size_t >::max()) const
Return a "sub slice" of given length starting at the given position.
std::size_t length() const noexcept
std::uint8_t operator[](std::size_t i) const noexcept
Access raw bytes.
bool empty() const noexcept
Return true if the byte range is empty.
std::ostream & operator<<(std::ostream &os, TOffer< TIn, TOut > const &offer)
bool operator==(Manifest const &lhs, Manifest const &rhs)
bool operator<(CanonicalTXSet::Key const &lhs, CanonicalTXSet::Key const &rhs)
T lexicographical_compare(T... args)
bool operator!=(Manifest const &lhs, Manifest const &rhs)
const_iterator cbegin() const noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void remove_prefix(std::size_t n)
Shrinks the slice by moving its start forward by n characters.
std::string strHex(FwdIt begin, FwdIt end)
void remove_suffix(std::size_t n)
Shrinks the slice by moving its end backward by n characters.
void hash_append(Hasher &h, ValidatorBlobInfo const &blobInfo)
value_type const * const_iterator
const_iterator begin() const noexcept