19#include <unordered_map>
57 m_data[key] =
Any(std::forward<T>(value));
73 template <MetadataKey metadataKey,
typename T>
77 std::is_convertible<T, typename detail::MetadataKeyTraits<metadataKey>::type>::value,
"Incorrect value type for metadata key");
79 detail::MetadataKeyTraits<metadataKey>::name,
static_cast<typename detail::MetadataKeyTraits<metadataKey>::type
>(value));
92 return m_data.find(name) != m_data.end();
105 template <MetadataKey metadataKey>
108 using trait = detail::MetadataKeyTraits<metadataKey>;
114 return hasCorrectType;
135 return m_data.at(key);
151 template <
typename T>
177 template <MetadataKey metadataKey>
180 using trait = detail::MetadataKeyTraits<metadataKey>;
199 for (
const auto& pair : metadata.m_data)
207 os <<
" \"" << pair.first <<
"\"";
227 std::ostringstream ss;
233 std::unordered_map<std::string, Any> m_data;
A type-erased container for any copyable value.
Definition peak_common_any.hpp:36
PEAK_COMMON_NO_DISCARD const std::type_info & GetType() const
Gets the type of the stored value.
Definition peak_common_any.hpp:164
T & AnyCast()
Casts the stored value to the specified type.
Definition peak_common_any.hpp:179
Thrown when a parameter is outside the valid range.
Definition peak_common_exceptions.hpp:111
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.
Definition peak_common_defines.hpp:91
Root namespace for common types and interfaces shared across multiple libraries.
Definition peak_common_math.hpp:22