1 #ifndef VTESTBED_ASSETS_OPTIONS_HH 2 #define VTESTBED_ASSETS_OPTIONS_HH 6 #include <unordered_map> 18 using key_type =
typename base_type::key_type;
19 using value_type =
typename base_type::value_type;
20 using mapped_type =
typename base_type::mapped_type;
21 using hasher =
typename base_type::hasher;
22 using key_equal =
typename base_type::key_equal;
23 using allocator_type =
typename base_type::allocator_type;
24 using pointer =
typename base_type::pointer;
25 using const_pointer =
typename base_type::const_pointer;
26 using reference =
typename base_type::reference;
27 using const_reference =
typename base_type::const_reference;
28 using iterator =
typename base_type::iterator;
29 using const_iterator =
typename base_type::const_iterator;
30 using local_iterator =
typename base_type::local_iterator;
31 using const_local_iterator =
typename base_type::const_local_iterator;
32 using size_type =
typename base_type::size_type;
33 using difference_type =
typename base_type::difference_type;
36 using base_type::base_type;
37 using base_type::operator=;
38 using base_type::operator[];
40 inline const std::any&
41 get(
const std::string& key,
const std::any& default_value)
const {
42 auto result = this->find(key);
43 if (result == this->end()) {
return default_value; }
44 return result->second;
47 template <
class T>
inline T
48 get(
const std::string& key, T default_value)
const {
49 auto result = this->find(key);
50 if (result == this->end()) {
return default_value; }
51 return std::any_cast<T>(result->second);
54 template <
class T>
inline T
56 auto result = this->find(key);
58 return std::any_cast<T>(result->second);
63 return get<std::string>(key);
75 #endif // vim:filetype=cpp