in native/include/etw_provider_api.hpp [92:111]
inline result_t<> write_event(uint64_t provider_handle, const event_descriptor & descriptor, const std::tuple<Args...> & data) noexcept {
auto visitor = [](const auto & arg) mutable -> event_data_field {
using type = std::decay_t<decltype(arg)>;
if constexpr(std::disjunction_v<std::is_same<type, const char *>, std::is_same<type, const wchar_t *>, std::is_same<type, const char16_t *>, std::is_same<type, const char32_t *>>) {
using char_type = std::remove_const_t<std::remove_pointer_t<type>>;
uint32_t size = static_cast<uint32_t>(std::char_traits<char_type>::length(arg) + 1) * sizeof(char_type);
return { reinterpret_cast<const uint8_t *>(arg), size };
}
else if constexpr(std::is_trivial_v<type> && std::is_standard_layout_v<type>)
return { reinterpret_cast<const uint8_t *>(&arg), sizeof(type) };
else {
static_assert(detail::false_v<type>, "Unsupported type: only trivial types and C-strings are supported");
return {};
}
};
return std::apply([&](const auto &... args) {
event_data_field result[] = { visitor(args)... };
return write_event(provider_handle, descriptor, result);
}, data);
}