.Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Helper.h
1 
2 #ifndef __CONSTANTS_HELPER_H__
3 #define __CONSTANTS_HELPER_H__
4 
5 #include <map>
6 
7 namespace MDSimulation
8 {
9  namespace Constants
10  {
11 
21  template <typename source>
22  inline std::map<source, int> invert_array_mapping(
23  source const * const arr, const int len)
24  {
25  std::map<source, int> retval;
26 
27  for (int i = 0; i < len; ++i)
28  {
29  retval[arr[i]] = i;
30  }
31 
32  return retval;
33  }
34  }
35 }
36 
37 #endif
std::map< source, int > invert_array_mapping(source const *const arr, const int len)
Function to invert an array mapping.
Definition: Helper.h:22