1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-28 12:02:00 +03:00
* Add some restriction on pair partial specialization of to_json

Signed-off-by: Camille Bégué <camille.begue.pro@gmail.com>
This commit is contained in:
Camille Bégué
2019-10-21 17:50:15 +02:00
committed by Camille Bégué
parent 0245ae5157
commit 794a3d411a
3 changed files with 20 additions and 4 deletions

View File

@ -3733,8 +3733,8 @@ void to_json(BasicJsonType& j, const T(&arr)[N])
external_constructor<value_t::array>::construct(j, arr);
}
template<typename BasicJsonType, typename... Args>
void to_json(BasicJsonType& j, const std::pair<Args...>& p)
template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value, int > = 0 >
void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
{
j = { p.first, p.second };
}