19 static_assert(
sizeof(T) == 1,
"type must be a byte");
29 std::fill_n(ptr, count, value);
43 std::copy_n(src, count, dest);
45 std::copy_backward(src, src + count, dest + count);
52 std::copy_n(src, count, dest);
59 for (; count != 0; --count, ++a, ++b)
73 return std::strlen(
reinterpret_cast<const char*
>(s));
82 const auto end = s + count;
83 const auto p = std::find(s, end, value);
84 return p != end ? p :
nullptr;
89using bytes = std::basic_string<unsigned char, byte_traits<unsigned char>>;
92using bytes_view = std::basic_string_view<unsigned char, byte_traits<unsigned char>>;
EVMC C++ API - wrappers and bindings for C++.
std::basic_string_view< unsigned char, byte_traits< unsigned char > > bytes_view
String view of unsigned chars representing bytes.
std::basic_string< unsigned char, byte_traits< unsigned char > > bytes
String of unsigned chars representing bytes.
The char traits for byte-like types.
static constexpr void assign(char_type &c1, const char_type &c2)
Assigns c2 to c1.
static constexpr char_type * copy(char_type *dest, const char_type *src, std::size_t count)
Copies count bytes from src to dest. The ranges must not overlap.
static std::size_t length(const char_type *s)
Returns the length of a null-terminated byte string.
static constexpr bool eq(char_type a, char_type b)
Returns true if bytes are equal.
static constexpr char_type * move(char_type *dest, const char_type *src, std::size_t count)
Copies count bytes from src to dest. Performs correctly even if ranges overlap.
static constexpr int compare(const char_type *a, const char_type *b, std::size_t count)
Compares lexicographically the bytes in two ranges of equal length.
static constexpr const char_type * find(const char_type *s, std::size_t count, const char_type &value)
Finds the value in the range of bytes and returns the pointer to the first occurrence or nullptr if n...
static constexpr bool lt(char_type a, char_type b)
Returns true if byte a is less than byte b.
T char_type
The byte type.
static constexpr char_type * assign(char_type *ptr, std::size_t count, char_type value)
Assigns value to each byte in [ptr, ptr+count).