Broom
1.0.0
A thread-local C++ Garbage Collector
Loading...
Searching...
No Matches
include
broom-map.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <map>
4
5
#include "
broom.h
"
6
#include "impl/broom-containers.h"
7
8
#define MAP_METHODS(X_) \
9
CPP11_MAP_METHODS(X_) \
10
CPP14_MAP_METHODS(X_) \
11
CPP17_MAP_METHODS(X_) \
12
CPP20_MAP_METHODS(X_) \
13
CPP23_MAP_METHODS(X_)
14
15
namespace
broom
{
27
// XXX(gc): Implement via forwarding instead?
28
template
<
typename
Key,
typename
T,
typename
Compare = std::less<Key>,
29
typename
Allocator = std::allocator<std::pair<const Key, T>>>
30
class
map
:
private
std::map<Key, T, Compare, Allocator>,
public
BroomValue
{
31
using
Base = std::map<Key, T, Compare, Allocator>;
32
33
public
:
34
DEF_TYPES()
35
DEF_CONSTRUCTOR
(
map
)
36
map
(std::
initializer_list
<std::
pair
<
const
Key
, T>>
il
,
37
const
Compare
&
comp
=
Compare
(),
const
Allocator
&
alloc
=
Allocator
())
38
: Base(
il
,
comp
,
alloc
),
BroomValue
() {}
39
DEF_METHODS
(
map
)
40
MAP_METHODS
(
USE_METHODS
)
41
virtual
void
Visit
(
Visitor
*
visitor
)
const
{
42
for
(
const
auto
& [
k
,
v
] : *
this
) {
43
VISIT_HELPER
(
k
,
Key
);
44
VISIT_HELPER
(
v
, T);
45
}
46
}
47
};
48
}
// namespace broom
49
50
#undef MAP_METHODS
51
52
#include "impl/broom-undef.h"
MAP_METHODS
#define MAP_METHODS(X_)
Definition
broom-map.h:8
broom.h
broom::Allocator
Definition
allocator.h:235
broom::BroomValue
Definition
broom.h:402
broom::Visitor
Definition
broom.h:353
broom::map
Definition
broom-map.h:30
broom::map::Visit
virtual void Visit(Visitor *visitor) const
Definition
broom-map.h:41
broom
Definition
allocator-inl.h:9
broom::queue
std::queue< T, broom::deque< T > > queue
Definition
broom-queue.h:12
Generated by
1.9.8