mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Merge pull request #229 from JaewooSeo/wvalue_vector
wvalue (json) support vector<wvalue>
This commit is contained in:
commit
2564c62778
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user