graph_analysis
MapInitializer.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYIS_MAP_INITIALIZER_HPP
2 #define GRAPH_ANALYIS_MAP_INITIALIZER_HPP
3 
4 #include <map>
5 namespace graph_analysis {
6 
7 template <typename T, typename U>
8 class InitMap
9 {
10 private:
11  std::map<T, U> mMap;
12 public:
13  InitMap(const T& key, const U& val)
14  {
15  mMap[key] = val;
16  }
17 
18  InitMap<T, U>& operator()(const T& key, const U& val)
19  {
20  mMap[key] = val;
21  return *this;
22  }
23 
24  operator std::map<T, U>()
25  {
26  return mMap;
27  }
28 };
29 
30 } // endif graph_analysis
31 #endif // GRAPH_ANALYIS_MAP_INITIALIZER_HPP
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
Definition: MapInitializer.hpp:8
InitMap< T, U > & operator()(const T &key, const U &val)
Definition: MapInitializer.hpp:18
InitMap(const T &key, const U &val)
Definition: MapInitializer.hpp:13