You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.
I think that's intentional. Since Json only supports double for storing numbers, it's not possible to convert "long double" -> Json without loss of precision, and thus we won't want to do it implicitly. Constructing a Json from a vector looks for T to be a type from which Json has a constructor, or a type which has a "to_json()" method, neither of which applies to long double. You need to do the static-cast yourself (probably in a loop) if you want to force the conversion.
Hi
I am using
json11
in my project. And when i am trying to return astd::vector
of typelong double
,json11
does not support it.And here is the error i am receiving
error: no matching function for call to ‘json11::Json::Json(std::vector&)’
json11::Json json(nav);
^
In file included from main.cpp:6:0:
/usr/local/include/json11.hpp:119:5: note: candidate: template<class V, typename std::enable_if<std::is_constructible<json11::Json, typename V::value_type>::value, int>::type > json11::Json::Json(const V&)
Json(const V & v) : Json(array(v.begin(), v.end())) {}
^~~~
/usr/local/include/json11.hpp:119:5: note: template argument deduction/substitution failed:
/usr/local/include/json11.hpp:118:26: error: no type named ‘type’ in ‘struct std::enable_if<false, int>’
int>::type = 0>
^
/usr/local/include/json11.hpp:118:26: note: invalid template non-type parameter
/usr/local/include/json11.hpp:113:5: note: candidate: template<class M, typename std::enable_if<(std::is_constructible<std::basic_string, typename M::key_type>::value && std::is_constructible<json11::Json, typename M::mapped_type>::value), int>::type > json11::Json::Json(const M&)
Json(const M & m) : Json(object(m.begin(), m.end())) {}
^~~~
/usr/local/include/json11.hpp:113:5: note: template argument deduction/substitution failed:
/usr/local/include/json11.hpp:111:9: error: no type named ‘key_type’ in ‘class std::vector’
std::is_constructible<std::string, typename M::key_type>::value
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&& std::is_constructible<Json, typename M::mapped_type>::value,
^~~~~~
/usr/local/include/json11.hpp:111:9: error: no type named ‘mapped_type’ in ‘class std::vector’
/usr/local/include/json11.hpp:112:26: note: invalid template non-type parameter
int>::type = 0>
^
/usr/local/include/json11.hpp:106:5: note: candidate: template<class T, class> json11::Json::Json(const T&)
Json(const T & t) : Json(t.to_json()) {}
^~~~
/usr/local/include/json11.hpp:106:5: note: template argument deduction/substitution failed:
/usr/local/include/json11.hpp:105:41: error: ‘to_json’ is not a member of ‘std::vector’
template <class T, class = decltype(&T::to_json)>
The text was updated successfully, but these errors were encountered: