Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Identify map- and vector-like objects in a VS14-compatible way
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Potter committed Aug 13, 2014
1 parent d9bdd84 commit 7103522
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions json11.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ class Json final {

// Implicit constructor: map-like objects (std::map, std::unordered_map, etc)
template <class M, typename std::enable_if<
std::is_constructible<std::string, decltype(std::declval<M>().begin()->first)>::value
&& std::is_constructible<Json, decltype(std::declval<M>().begin()->second)>::value,
std::is_constructible<std::string, typename M::key_type>::value
&& std::is_constructible<Json, typename M::mapped_type>::value,
int>::type = 0>
Json(const M & m) : Json(object(m.begin(), m.end())) {}

// Implicit constructor: vector-like objects (std::list, std::vector, std::set, etc)
template <class V, typename std::enable_if<
std::is_constructible<Json, decltype(*std::declval<V>().begin())>::value,
std::is_constructible<Json, typename V::value_type>::value,
int>::type = 0>
Json(const V & v) : Json(array(v.begin(), v.end())) {}

Expand Down

0 comments on commit 7103522

Please sign in to comment.