5 #include <zk/config.hpp>
15 #ifndef ZKPP_BUFFER_USE_STD_STRING
16 # define ZKPP_BUFFER_USE_STD_STRING 0
30 #ifndef ZKPP_BUFFER_USE_CUSTOM
31 # define ZKPP_BUFFER_USE_CUSTOM 0
36 #ifndef ZKPP_BUFFER_USE_STD_VECTOR
37 # if ZKPP_BUFFER_USE_STD_STRING || ZKPP_BUFFER_USE_CUSTOM
38 # define ZKPP_BUFFER_USE_STD_VECTOR 0
40 # define ZKPP_BUFFER_USE_STD_VECTOR 1
44 #if ZKPP_BUFFER_USE_STD_VECTOR
45 # define ZKPP_BUFFER_INCLUDE <vector>
46 # define ZKPP_BUFFER_TYPE std::vector<char>
47 #elif ZKPP_BUFFER_USE_STD_STRING
48 # define ZKPP_BUFFER_INCLUDE <string>
49 # define ZKPP_BUFFER_TYPE std::string
50 #elif ZKPP_BUFFER_USE_CUSTOM
51 # if !defined ZKPP_BUFFER_INCLUDE || !defined ZKPP_BUFFER_TYPE
52 # error "When ZKPP_BUFFER_USE_CUSTOM is set, you must also define ZKPP_BUFFER_INCLUDE and ZKPP_BUFFER_TYPE"
55 # error "Unknown type to use for zk::buffer"
60 #include ZKPP_BUFFER_INCLUDE
82 static_assert(
sizeof(buffer::value_type) == 1,
"buffer::value_type must be single-byte elements");
83 static_assert(std::is_same<std::size_t, buffer::size_type>::value,
"buffer::size_type must be std::size_t");
85 "buffer must be constructible with two pointers"
87 static_assert(std::is_move_constructible<buffer>::value,
"buffer must be move-constructible");
88 static_assert(std::is_same<decltype(std::declval<const buffer&>().size()), buffer::size_type>::value,
89 "buffer::size() must return buffer::size_type"
92 decltype(std::declval<const buffer&>().data())
94 "buffer::data() must return ptr<const buffer::value_type>"
T * ptr
A simple, unowned pointer.
#define ZKPP_BUFFER_TYPE
The type name to use for the buffer type.
ZKPP_BUFFER_TYPE buffer
The buffer type.