Go to the documentation of this file.00001 #include "util.h"
00002 #include <iostream>
00003
00004 namespace util
00005 {
00006
00007 template<>
00008 double parse<double>(std::string const& str)
00009 {
00010 return atof(str.c_str());
00011 }
00012
00013 template<>
00014 int64_t parse<int64_t>(std::string const& str)
00015 {
00016 return atol(str.c_str());
00017 }
00018
00019 std::string replace(std::string const& input, std::map<char, std::string> const& repl)
00020 {
00021 std::ostringstream stream;
00022 for (auto it = input.begin(); it != input.end(); ++it)
00023 {
00024 auto rep_it = repl.find(*it);
00025 if (rep_it != repl.end())
00026 stream << rep_it->second;
00027 else
00028 stream << *it;
00029 }
00030 return stream.str();
00031 }
00032
00033 }