3#include <xrpl/basics/contract.h>
4#include <xrpl/basics/strHex.h>
5#include <xrpl/beast/utility/instrumentation.h>
40 operator=(
Slice const&) noexcept = default;
87 XRPL_ASSERT(i <
size_,
"xrpl::Slice::operator[](std::size_t) const : valid input");
173template <
class Hasher>
183 if (lhs.size() != rhs.size())
189 return std::memcmp(lhs.data(), rhs.data(), lhs.size()) == 0;
195 return !(lhs == rhs);
202 lhs.data(), lhs.data() + lhs.size(), rhs.data(), rhs.data() + rhs.size());
205template <
class Stream>
213template <
class T, std::
size_t N>
220template <
class T,
class Alloc>
227template <
class Traits,
class Alloc>
An immutable linear range of bytes.
const_iterator begin() const noexcept
std::size_t length() const noexcept
bool empty() const noexcept
Return true if the byte range is empty.
std::uint8_t const * data() const noexcept
Return a pointer to beginning of the storage.
std::uint8_t const * data_
Slice() noexcept=default
Default constructed Slice has length 0.
std::size_t size() const noexcept
Returns the number of bytes in the storage.
Slice & operator+=(std::size_t n)
Advance the buffer.
value_type const * const_iterator
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::uint8_t operator[](std::size_t i) const noexcept
Access raw bytes.
void removePrefix(std::size_t n)
Shrinks the slice by moving its start forward by n characters.
void removeSuffix(std::size_t n)
Shrinks the slice by moving its end backward by n characters.
Slice operator+(std::size_t n) const
const_iterator cend() const noexcept
const_iterator cbegin() const noexcept
const_iterator end() const noexcept
T lexicographical_compare(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool operator<(Slice const &lhs, Slice const &rhs) noexcept
constexpr bool operator==(BaseUInt< Bits, Tag > const &lhs, BaseUInt< Bits, Tag > const &rhs)
std::string strHex(FwdIt begin, FwdIt end)
std::ostream & operator<<(std::ostream &out, BaseUInt< Bits, Tag > const &u)
Dir::ConstIterator const_iterator
bool operator!=(Buffer const &lhs, Buffer const &rhs) noexcept
void hash_append(Hasher &h, Slice const &v)
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
std::enable_if_t< std::is_same_v< T, char >||std::is_same_v< T, unsigned char >, Slice > makeSlice(std::array< T, N > const &a)