MC_helper_stl.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _MC_HELPER_STL_HPP_
00020 #define _MC_HELPER_STL_HPP_
00021
00022 #include <iostream>
00023 #include <vector>
00024 #include <map>
00025
00026 namespace mesh_conv
00027 {
00029 class MC_helper_stl
00030 {
00031 public:
00032
00034 template <class TA,class TB>
00035 static std::vector<TB> map_arg2_to_vector(const std::map<TA,TB>& m)
00036 {
00037 typename std::map<TA,TB>::const_iterator it=m.begin();
00038 typename std::map<TA,TB>::const_iterator it_end=m.end();
00039
00040 std::vector <TB> vec;
00041 for(;it!=it_end;++it)
00042 vec.push_back(it->second);
00043 return vec;
00044 }
00045
00047 template <class TA,class TB>
00048 static std::map<TB,TA> reverse_map(const std::map<TA,TB>& m)
00049 {
00050 std::map <TB,TA> reversed;
00051 typename std::map <TA,TB> :: const_iterator it=m.begin();
00052 typename std::map <TA,TB> :: const_iterator it_end=m.end();
00053 for(;it!=it_end;++it)
00054 reversed.insert(std::make_pair(it->second,it->first));
00055 return reversed;
00056 }
00057
00058 private:
00059 };
00060 }
00061
00062 #endif