32 static size_t uleb128_size(uint64_t value);
33 static size_t sleb128_size(int64_t value);
34 using pos_type = std::streampos;
35 using off_type = std::streamoff;
38 void reserve(
size_t size);
43 return write(sp.data(), sp.size());
52 template<class T, typename = typename std::enable_if<std::is_standard_layout<T>::value && std::is_trivial<T>::value>::type>
54 const auto pos =
static_cast<size_t>(tellp());
55 if (raw_.size() < (pos +
sizeof(T))) {
56 raw_.resize(pos +
sizeof(T));
58 memcpy(raw_.data() + pos, &t,
sizeof(T));
59 current_pos_ +=
sizeof(T);
71 template<
typename T,
size_t size>
73 static_assert(std::numeric_limits<T>::is_integer,
"Requires integer type");
83 for (
const T& e : elements) {
102 vector_iostream& seekp(vector_iostream::off_type p, std::ios_base::seekdir dir);
104 const std::vector<uint8_t>& raw()
const;
105 std::vector<uint8_t>& raw();
107 void set_endian_swap(
bool swap);
110 pos_type current_pos_ = 0;
111 std::vector<uint8_t> raw_;
112 bool endian_swap_ =
false;