17 lines
391 B
C++
17 lines
391 B
C++
#include <algorithm>
|
|
#include <bytes.hpp>
|
|
|
|
namespace utilities {
|
|
namespace bytes {
|
|
|
|
std::vector<std::byte> to_bytes(const std::string &value) {
|
|
std::vector<std::byte> bytes;
|
|
bytes.reserve(value.size());
|
|
std::transform(std::begin(value), std::end(value), std::back_inserter(bytes), [](char c) { return std::byte(c); });
|
|
return bytes;
|
|
}
|
|
|
|
|
|
} // namespace bytes
|
|
} // namespace utilities
|