kcurl v0.1.10
Basic C++23 wrapper over libcurl
 
Loading...
Searching...
No Matches
byte_array.hpp
Go to the documentation of this file.
1#pragma once
2#include <cstddef>
3#include <string_view>
4#include <vector>
5
6namespace kcurl {
7struct ByteArray {
9 [[nodiscard]] constexpr auto as_string_view() const -> std::string_view {
10 void const* data = bytes.data();
11 if (!data) { return {}; }
12 return std::string_view{static_cast<char const*>(data), bytes.size()};
13 }
14
15 std::vector<std::byte> bytes{};
16};
17} // namespace kcurl
Definition byte_array.hpp:6
Definition byte_array.hpp:7
std::vector< std::byte > bytes
Definition byte_array.hpp:15
constexpr auto as_string_view() const -> std::string_view
Definition byte_array.hpp:9