Repository navigation
Open
Description
I'd like to use response<vector<pair<T, U>>> or response<absl::flat_hash_map<T, U>> as my response type for HGETALL, but the adapter is hardcoded to only support the standard library associative containers:
redis/include/boost/redis/adapter/detail/adapters.hpp
Lines 487 to 530 in 6f17663
| template <class T> | |
| struct impl_map { | |
| using type = simple_impl<T>; | |
| }; | |
| template <class Key, class Compare, class Allocator> | |
| struct impl_map<std::set<Key, Compare, Allocator>> { | |
| using type = set_impl<std::set<Key, Compare, Allocator>>; | |
| }; | |
| template <class Key, class Compare, class Allocator> | |
| struct impl_map<std::multiset<Key, Compare, Allocator>> { | |
| using type = set_impl<std::multiset<Key, Compare, Allocator>>; | |
| }; | |
| template <class Key, class Hash, class KeyEqual, class Allocator> | |
| struct impl_map<std::unordered_set<Key, Hash, KeyEqual, Allocator>> { | |
| using type = set_impl<std::unordered_set<Key, Hash, KeyEqual, Allocator>>; | |
| }; | |
| template <class Key, class Hash, class KeyEqual, class Allocator> | |
| struct impl_map<std::unordered_multiset<Key, Hash, KeyEqual, Allocator>> { | |
| using type = set_impl<std::unordered_multiset<Key, Hash, KeyEqual, Allocator>>; | |
| }; | |
| template <class Key, class T, class Compare, class Allocator> | |
| struct impl_map<std::map<Key, T, Compare, Allocator>> { | |
| using type = map_impl<std::map<Key, T, Compare, Allocator>>; | |
| }; | |
| template <class Key, class T, class Compare, class Allocator> | |
| struct impl_map<std::multimap<Key, T, Compare, Allocator>> { | |
| using type = map_impl<std::multimap<Key, T, Compare, Allocator>>; | |
| }; | |
| template <class Key, class Hash, class KeyEqual, class Allocator> | |
| struct impl_map<std::unordered_map<Key, Hash, KeyEqual, Allocator>> { | |
| using type = map_impl<std::unordered_map<Key, Hash, KeyEqual, Allocator>>; | |
| }; | |
| template <class Key, class Hash, class KeyEqual, class Allocator> | |
| struct impl_map<std::unordered_multimap<Key, Hash, KeyEqual, Allocator>> { | |
| using type = map_impl<std::unordered_multimap<Key, Hash, KeyEqual, Allocator>>; | |
| }; |
It's also missing the new ones from C++23 (ie. flat_map). It would ideally support anything with a "map-like" interface.
Metadata
Metadata
Assignees
Labels
No labels
Activity
anarthal commentedon Jul 10, 2026
Thanks for reporting. I think we have two (potentially compatible) courses of action:
insert()as part of the map implementation, so this would allow you to use theabslcontainers, the C++23 containers and the ones in Boost.Unordered, but notvector<pair<T, U>>becausevectorhas noinsert.I think 2 should be the ultimate goal, but starting with 1 seems wiser. The adapter interface looks pretty convoluted at the moment, so we'd probably have to revisit it before documenting it.
@mzimbres what do you think?
mzimbres commentedon Jul 13, 2026
Hi, I will investigate.
mzimbres commentedon Aug 8, 2026
Hi, support for
response<vector<pair<T, U>>>is now available in the develop branch https://github.com/boostorg/redis/blob/develop/example/cpp20_containers.cpp#L94-L96