Skip to content

Commit

Permalink
utils: add make_bytes()
Browse files Browse the repository at this point in the history
  • Loading branch information
rtgiskard committed Oct 6, 2024
1 parent 437f5a1 commit 426247d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils/misc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef INCLUDE_UTILS_MISC_H
#define INCLUDE_UTILS_MISC_H

#include <cstddef>
#include <cstdint>
#include <string>

Expand All @@ -16,6 +17,11 @@ std::string hexFromBytes(const T * bytes, const uint32_t size);
template <Byte T>
bool hexToBytes(const std::string & hex, T * bytes, const uint32_t size);

template <typename... Ts>
std::array<std::byte, sizeof...(Ts)> make_bytes(Ts &&... args) noexcept {
return {std::byte(std::forward<Ts>(args))...};
}

}; // namespace utils
}; // namespace mtrx

Expand Down

0 comments on commit 426247d

Please sign in to comment.