[Cppcms-users] json serialization issue
Brought to you by:
artyom-beilis
|
From: Lee E. <lee...@gm...> - 2013-01-09 22:48:09
|
can anyone point me to what i did wrong in this code:
namespace cppcms {
namespace json {
template<typename V>
struct traits<std::map<std::string,V>> {
static std::map<std::string,V> get(const value& val) {
std::map<std::string,V> m;
for(auto p : val.object())
m[p.first]=traits<V>::get(p.second);
return m;
}
static void set(value& v, const std::map<std::string,V> m) {
auto o = v.object();
for(auto p : m) {
o[p.first]=value(p.second);
}
}
};
} // namespace json
} // namespace cppcms
when i try to use this:
std::map<string, cppcms::json::value> m;
...
cppcms::json::value v(m);
i get the bad_value_cast exception
thanks
lee
--
--
lee
Lee Elenbaas
lee...@gm...
|