diff options
author | Jaeseung Ha <ipknhama@gmail.com> | 2017-09-17 19:17:54 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-17 19:17:54 +0900 |
commit | d8c4a671760fda8e83279b9383108f0951367fb6 (patch) | |
tree | 0ad063878c09eec987d1d8054b66d11fd629ce30 /include/crow/json.h | |
parent | 26c4d5ddef6920043ae40a9d80ca31f3b820bad5 (diff) | |
parent | 414809c742521926ca08fbd355b92f3ae877064f (diff) | |
download | crow-d8c4a671760fda8e83279b9383108f0951367fb6.tar.gz crow-d8c4a671760fda8e83279b9383108f0951367fb6.zip |
Merge branch 'master' into master
Diffstat (limited to 'include/crow/json.h')
-rw-r--r-- | include/crow/json.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/crow/json.h b/include/crow/json.h index 53ed45f..3d9ed18 100644 --- a/include/crow/json.h +++ b/include/crow/json.h @@ -1264,6 +1264,23 @@ namespace crow return *this; } + wvalue& operator=(std::vector<wvalue>&& v) + { + if (t_ != type::List) + reset(); + t_ = type::List; + if (!l) + l = std::unique_ptr<std::vector<wvalue>>(new std::vector<wvalue>{}); + l->clear(); + l->resize(v.size()); + size_t idx = 0; + for(auto& x:v) + { + (*l)[idx++] = std::move(x); + } + return *this; + } + template <typename T> wvalue& operator=(const std::vector<T>& v) { @@ -1394,7 +1411,12 @@ namespace crow case type::Number: { char outbuf[128]; +#ifdef _MSC_VER + sprintf_s(outbuf, 128, "%g", v.d); +#else sprintf(outbuf, "%g", v.d); +#endif + out += outbuf; } break; |