19#include <unordered_map>
59 m_data[key] =
Any(std::forward<T>(value));
75 template <MetadataKey metadataKey,
typename T>
79 std::is_convertible<T, typename detail::MetadataKeyTraits<metadataKey>::type>::value,
"Incorrect value type for metadata key");
81 detail::MetadataKeyTraits<metadataKey>::Name(),
static_cast<typename detail::MetadataKeyTraits<metadataKey>::type
>(value));
94 return m_data.find(name) != m_data.end();
107 template <MetadataKey metadataKey>
110 using trait = detail::MetadataKeyTraits<metadataKey>;
116 return hasCorrectType;
137 return m_data.at(key);
153 template <
typename T>
179 template <MetadataKey metadataKey>
182 using trait = detail::MetadataKeyTraits<metadataKey>;
201 for (
const auto& pair : metadata.m_data)
209 os <<
" \"" << pair.first <<
"\"";
229 std::ostringstream ss;
243 std::vector<std::string> keys;
244 keys.reserve(m_data.size());
245 std::transform(m_data.cbegin(), m_data.cend(), std::back_inserter(keys), [](
const auto& pair) {
253 std::unordered_map<std::string, Any> m_data;
A type-erased container for any copyable value.
Definition peak_common_any.hpp:36
T & AnyCast()
Casts the stored value to the specified type.
Definition peak_common_any.hpp:179
PEAK_COMMON_NO_DISCARD const std::type_info & GetType() const
Gets the type of the stored value.
Definition peak_common_any.hpp:164
Thrown when a parameter is outside the valid range.
Definition peak_common_exceptions.hpp:119
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.
Definition peak_common_defines.h:86
Root namespace for common types and interfaces shared across multiple libraries.
Definition peak_common_math.hpp:22
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_dynamic_loader.h:33