diff options
author | Jaeseung Ha <ipknhama@gmail.com> | 2017-09-17 12:40:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-17 12:40:05 +0900 |
commit | 2564c62778b1271f830dc4ad551f8804df6010f8 (patch) | |
tree | 23d346d6b3c5b1871a4fa3ef9cd40e429457bc94 | |
parent | cb9090b7c131280b127370f2f0cea18f0df57a1c (diff) | |
parent | 777852c97d06bd93d0c5a42be0846d98df10609c (diff) | |
download | crow-2564c62778b1271f830dc4ad551f8804df6010f8.tar.gz crow-2564c62778b1271f830dc4ad551f8804df6010f8.zip |
Merge pull request #229 from JaewooSeo/wvalue_vector
wvalue (json) support vector<wvalue>
-rw-r--r-- | include/crow/json.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/crow/json.h b/include/crow/json.h index 891fedf..8b58180 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) { |