Thrill  0.1
unordered_set.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/logger/unordered_set.hpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2018 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #ifndef TLX_LOGGER_UNORDERED_SET_HEADER
12 #define TLX_LOGGER_UNORDERED_SET_HEADER
13 
14 #include <tlx/logger/core.hpp>
15 
16 #include <unordered_set>
17 
18 namespace tlx {
19 
20 template <typename T, typename H, typename E, typename A>
21 class LoggerFormatter<std::unordered_set<T, H, E, A> >
22 {
23 public:
24  static void print(std::ostream& os,
25  const std::unordered_set<T, H, E, A>& data) {
26  os << '{';
27  for (typename std::unordered_set<T, H, E, A>::const_iterator
28  it = data.begin(); it != data.end(); ++it)
29  {
30  if (it != data.begin()) os << ',';
32  }
33  os << '}';
34  }
35 };
36 
37 template <typename T, typename H, typename E, typename A>
38 class LoggerFormatter<std::unordered_multiset<T, H, E, A> >
39 {
40 public:
41  static void print(std::ostream& os,
42  const std::unordered_multiset<T, H, E, A>& data) {
43  os << '{';
44  for (typename std::unordered_multiset<T, H, E, A>::const_iterator
45  it = data.begin(); it != data.end(); ++it)
46  {
47  if (it != data.begin()) os << ',';
49  }
50  os << '}';
51  }
52 };
53 
54 } // namespace tlx
55 
56 #endif // !TLX_LOGGER_UNORDERED_SET_HEADER
57 
58 /******************************************************************************/
STL namespace.
static void print(std::ostream &os, const std::unordered_multiset< T, H, E, A > &data)
template class for formatting. contains a print() method.
Definition: core.hpp:25
static void print(std::ostream &os, const std::unordered_set< T, H, E, A > &data)