Skip to content

How to support object containers outside std? #1584

Answered by stephenberry
meastp asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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>>;

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@meastp
Comment options

Answer selected by meastp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1580 on January 31, 2025 18:53.