2024-05-31 22:59:00 -04:00
|
|
|
#ifndef RFL_PARSING_IS_MAP_LIKE_HPP_
|
|
|
|
#define RFL_PARSING_IS_MAP_LIKE_HPP_
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <type_traits>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
namespace rfl {
|
2024-06-08 14:10:59 -04:00
|
|
|
namespace parsing {
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
template <class T>
|
|
|
|
class is_map_like;
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
template <class T>
|
|
|
|
class is_map_like : public std::false_type {};
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
template <class K, class V>
|
|
|
|
class is_map_like<std::map<K, V>> : public std::true_type {};
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
template <class K, class V>
|
|
|
|
class is_map_like<std::multimap<K, V>> : public std::true_type {};
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
template <class K, class V>
|
|
|
|
class is_map_like<std::unordered_map<K, V>> : public std::true_type {};
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
template <class K, class V>
|
|
|
|
class is_map_like<std::unordered_multimap<K, V>> : public std::true_type {};
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
template <class T>
|
|
|
|
constexpr bool is_map_like_v =
|
|
|
|
is_map_like<std::remove_cvref_t<std::remove_pointer_t<T>>>::value;
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
} // namespace parsing
|
|
|
|
} // namespace rfl
|
2024-05-31 22:59:00 -04:00
|
|
|
|
|
|
|
#endif
|