Skip to content

Commit 0b2cc97

Browse files
authored
Merge branch 'nlohmann:develop' into issue5210
2 parents 2360aad + 02dfbea commit 0b2cc97

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

include/nlohmann/detail/conversions/from_json.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,11 @@ inline void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Has
558558
}
559559

560560
#if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM
561+
562+
// Workaround for MSVC 19.51 (and possibly later): in large in large cpp files, the compiler may fail to resolve with generic has_from_json (issue #4996)
563+
template<typename BasicJsonType>
564+
struct has_from_json<BasicJsonType, std_fs::path, void> : std::true_type {};
565+
561566
template<typename BasicJsonType>
562567
inline void from_json(const BasicJsonType& j, std_fs::path& p)
563568
{

include/nlohmann/detail/conversions/to_json.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,10 @@ inline void to_json(BasicJsonType& j, const std::basic_string<char8_t, Tr, Alloc
450450
}
451451
#endif
452452

453+
// Workaround for MSVC 19.51 (and possibly later): in large cpp files, the compiler may fail to resolve with generic has_to_json (issue #4996)
454+
template<typename BasicJsonType>
455+
struct has_to_json<BasicJsonType, std_fs::path, void> : std::true_type {};
456+
453457
template<typename BasicJsonType>
454458
inline void to_json(BasicJsonType& j, const std_fs::path& p)
455459
{

single_include/nlohmann/json.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5668,6 +5668,11 @@ inline void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Has
56685668
}
56695669

56705670
#if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM
5671+
5672+
// Workaround for MSVC 19.51 (and possibly later): in large in large cpp files, the compiler may fail to resolve with generic has_from_json (issue #4996)
5673+
template<typename BasicJsonType>
5674+
struct has_from_json<BasicJsonType, std_fs::path, void> : std::true_type {};
5675+
56715676
template<typename BasicJsonType>
56725677
inline void from_json(const BasicJsonType& j, std_fs::path& p)
56735678
{
@@ -6451,6 +6456,10 @@ inline void to_json(BasicJsonType& j, const std::basic_string<char8_t, Tr, Alloc
64516456
}
64526457
#endif
64536458

6459+
// Workaround for MSVC 19.51 (and possibly later): in large cpp files, the compiler may fail to resolve with generic has_to_json (issue #4996)
6460+
template<typename BasicJsonType>
6461+
struct has_to_json<BasicJsonType, std_fs::path, void> : std::true_type {};
6462+
64546463
template<typename BasicJsonType>
64556464
inline void to_json(BasicJsonType& j, const std_fs::path& p)
64566465
{

0 commit comments

Comments
 (0)