How to support object containers outside std? #1584
-
I tried to find the source code for supporting std::map / std::unordered_map in glaze, but couldn't find it. Could you point to the source and/or give an example how to support other object/map containers? There are containers, e.g. boost.unordered that are a lot faster than std:: which I would like to use... :) Perhaps this would increase the performance of json pointer lookup (through one or more object containers) as well? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Glaze uses C++20 concepts to support types, this means that Glaze supports In template <class T>
concept readable_map_t = !custom_read<T> && !meta_value_t<T> && !str_t<T> && range<T> &&
pair_t<range_value_t<T>> && map_subscriptable<std::decay_t<T>>;
template <class T>
concept writable_map_t = !custom_write<T> && !meta_value_t<T> && !str_t<T> && range<T> &&
pair_t<range_value_t<T>> && map_subscriptable<std::decay_t<T>>; |
Beta Was this translation helpful? Give feedback.
Glaze uses C++20 concepts to support types, this means that Glaze supports
std::map / std::unordered_map
and any containers that have similar APIs. So, a lot of third party maps optimized for different use cases will just work automatically.In
common.hpp
there are the following concepts for maps: