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>
53 Slice() noexcept = default;
57 operator=(
Slice const&) noexcept = default;
106 Throw<std::domain_error>(
"too small");
147 template <
class Hasher>
157 if (lhs.size() != rhs.size())
163 return std::memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;
169 return !(lhs == rhs);
177 lhs.data() + lhs.size(),
179 rhs.data() + rhs.size());
182 template <
class Stream>
190 template <
class T, std::
size_t N>
199 template <
class T,
class Alloc>
208 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.
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)
T lexicographical_compare(T... args)
bool operator!=(Manifest const &lhs, Manifest const &rhs)
std::uint8_t const * const_iterator
const_iterator cbegin() const noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void hash_append(Hasher &h, Slice const &v)
std::string strHex(FwdIt begin, FwdIt end)
bool operator<(base_uint< Bits, Tag > const &a, base_uint< Bits, Tag > const &b)
const_iterator begin() const noexcept