3#include <boost/pfr.hpp>
10 return __PRETTY_FUNCTION__;
13 template<
typename T,
typename Tuple, std::size_t... Indexes>
15 constexpr size_t finalSize =
18 (
sizeof...(Indexes) > 0 ? -1 : 0) + 1 + 1;
20 std::array<char, finalSize> signature{};
22 char* cursor = signature.data();
23 auto append = [&](
const std::string_view sv) {
24 for (
const char c : sv) {
31 ((append(
GetTypeHelper<std::tuple_element_t<Indexes, Tuple>>()), append(Indexes ==
sizeof...(Indexes) - 1 ?
"" :
",")), ...);
39 static_assert(std::is_aggregate_v<T>,
"Type must be an aggregate.");
41 using MemberTuple =
decltype(boost::pfr::structure_to_tuple(std::declval<T>()));
42 constexpr size_t memberCount = std::tuple_size_v<MemberTuple>;
58 const auto view = std::string_view(signature.data(), signature.size() - 1);
59 return fnv1a64(view.data(), view.size());
consteval std::string_view GetTypeHelper()
consteval auto GenerateTypeSignature(std::index_sequence< Indexes... >)
consteval auto GetTypeSignature()
A namespace for utilities of different kinds.
constexpr std::uint64_t fnv1a64(const char *str, const std::size_t len)
Computes the 64bit FNV-1a string hash.
consteval uint64_t GetAggregateStructUID()
Generates a stable, unique ID for an aggregate struct at compile-time.