json: serialisation/instantiation from size_t

This commit is contained in:
Danny Robson 2014-09-01 16:25:24 +10:00
parent 61ee601df1
commit fcd40105a7
2 changed files with 8 additions and 1 deletions

View File

@ -586,6 +586,12 @@ namespace json {
return std::unique_ptr<node> (new number (i)); return std::unique_ptr<node> (new number (i));
} }
template <>
std::unique_ptr<node>
io<size_t>::serialise (const size_t &i) {
return std::unique_ptr<node> (new number (i));
}
template <> template <>
std::unique_ptr<node> std::unique_ptr<node>
io<float>::serialise (const float &f) { io<float>::serialise (const float &f) {

View File

@ -189,7 +189,8 @@ namespace json {
public: public:
explicit number (double _value): m_value (_value) { ; } explicit number (double _value): m_value (_value) { ; }
explicit number (int _value): m_value (_value) { ; } explicit number (int _value): m_value (_value) { ; }
explicit number (size_t _value): m_value (_value) { ; }
virtual const number& as_number (void) const { return *this; } virtual const number& as_number (void) const { return *this; }
virtual bool is_number (void) const { return true; } virtual bool is_number (void) const { return true; }