tlx
Toggle main menu visibility
Loading...
Searching...
No Matches
unordered_map.hpp
Go to the documentation of this file.
1
/*******************************************************************************
2
* tlx/logger/unordered_map.hpp
3
*
4
* Part of tlx - http://panthema.net/tlx
5
*
6
* Copyright (C) 2018 Timo Bingmann <tb@panthema.net>
7
*
8
* All rights reserved. Published under the Boost Software License, Version 1.0
9
******************************************************************************/
10
11
#ifndef TLX_LOGGER_UNORDERED_MAP_HEADER
12
#define TLX_LOGGER_UNORDERED_MAP_HEADER
13
14
#include <
tlx/logger/core.hpp
>
15
16
#include <unordered_map>
17
18
namespace
tlx
{
19
20
template
<
typename
K,
typename
V,
typename
H,
typename
E,
typename
A>
21
class
LoggerFormatter
<
std
::unordered_map<K, V, H, E, A> >
22
{
23
public
:
24
static
void
print
(std::ostream& os,
25
const
std::unordered_map<K, V, H, E, A>& data) {
26
os <<
'{'
;
27
for
(
typename
std::unordered_map<K, V, H, E, A>::const_iterator
28
it = data.begin(); it != data.end(); ++it)
29
{
30
if
(it != data.begin()) os <<
','
;
31
LoggerFormatter<K>::print
(os, it->first);
32
os <<
'='
;
33
LoggerFormatter<V>::print
(os, it->second);
34
}
35
os <<
'}'
;
36
}
37
};
38
39
template
<
typename
K,
typename
V,
typename
H,
typename
E,
typename
A>
40
class
LoggerFormatter
<
std
::unordered_multimap<K, V, H, E, A> >
41
{
42
public
:
43
static
void
print
(std::ostream& os,
44
const
std::unordered_multimap<K, V, H, E, A>& data) {
45
os <<
'{'
;
46
for
(
typename
std::unordered_multimap<K, V, H, E, A>::const_iterator
47
it = data.begin(); it != data.end(); ++it)
48
{
49
if
(it != data.begin()) os <<
','
;
50
LoggerFormatter<K>::print
(os, it->first);
51
os <<
'='
;
52
LoggerFormatter<V>::print
(os, it->second);
53
}
54
os <<
'}'
;
55
}
56
};
57
58
}
// namespace tlx
59
60
#endif
// !TLX_LOGGER_UNORDERED_MAP_HEADER
61
62
/******************************************************************************/
tlx::LoggerFormatter< std::unordered_map< K, V, H, E, A > >::print
static void print(std::ostream &os, const std::unordered_map< K, V, H, E, A > &data)
Definition
unordered_map.hpp:24
tlx::LoggerFormatter< std::unordered_multimap< K, V, H, E, A > >::print
static void print(std::ostream &os, const std::unordered_multimap< K, V, H, E, A > &data)
Definition
unordered_map.hpp:43
tlx::LoggerFormatter
template class for formatting. contains a print() method.
Definition
core.hpp:25
core.hpp
std
STL namespace.
tlx
Definition
exclusive_scan.hpp:17
tlx
logger
unordered_map.hpp
Generated on
for tlx by
1.17.0