9 #include <unordered_map>
21 template <
class Map
class>
23 using map_t = Mapclass;
26 using realiterator_t =
typename std::conditional<std::is_const<map_t>::value,
27 typename map_t::const_iterator,
28 typename map_t::iterator>::type;
29 using value_t =
typename std::add_const<typename map_t::key_type>::type;
32 iterator( realiterator_t x ) : under( x ) {}
34 auto operator*() ->
typename std::add_lvalue_reference<value_t>::type {
37 auto operator->() ->
typename std::add_pointer<value_t>::type {
return &under->first; }
39 bool operator!=(
const iterator& o )
const {
return under != o.under; }
41 iterator& operator++() {
45 iterator operator++(
int ) {
53 virtual inline ~
map_keys() =
default;
55 iterator begin() {
return iterator( x_.begin() ); }
56 iterator end() {
return iterator( x_.end() ); }
57 unsigned int size()
const {
return x_.size(); }
68 template <
class Map
class>
70 using map_t = Mapclass;
73 using realiterator_t =
typename std::conditional<std::is_const<map_t>::value,
74 typename map_t::const_iterator,
75 typename map_t::iterator>::type;
77 typename std::conditional<std::is_const<map_t>::value,
78 typename std::add_const<typename map_t::mapped_type>::type,
79 typename map_t::mapped_type>::type;
82 iterator( realiterator_t x ) : under( x ) {}
84 auto operator*() ->
typename std::add_lvalue_reference<value_t>::type {
87 auto operator->() ->
typename std::add_pointer<value_t>::type {
return &under->second; }
89 bool operator!=(
const iterator& o )
const {
return under != o.under; }
91 iterator& operator++() {
95 iterator operator++(
int ) {
104 iterator begin() {
return iterator( x_.begin() ); }
105 iterator end() {
return iterator( x_.end() ); }
106 unsigned int size()
const {
return x_.size(); }
Generate a range to iterate over the keys of a map.
Generate a range to iterate over the values of a map.