diff --git a/include/json.hpp b/include/json.hpp index ba46f1e..95b2e66 100644 --- a/include/json.hpp +++ b/include/json.hpp @@ -1452,8 +1452,8 @@ template template typename vector_t> inline vector_t basic_array::to_vector() const { - vector_t result; + if constexpr (_to_vector_helper::has_emplace_back>::value) { for (const auto& elem : _array_data) { result.emplace_back(elem.template as()); @@ -1464,6 +1464,7 @@ inline vector_t basic_array::to_vector() const result.emplace(elem.template as()); } } + return result; }