1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-31 10:24:23 +03:00

make to_json SFINAE-correct

This commit is contained in:
Théo DELRIEU
2018-09-06 16:08:01 +02:00
parent f7c8a2145a
commit f7971f04a5
3 changed files with 22 additions and 58 deletions

View File

@ -35,9 +35,11 @@ struct adl_serializer
@param[in,out] j JSON value to write to
@param[in] val value to read from
*/
template<typename BasicJsonType, typename ValueType>
static void to_json(BasicJsonType& j, ValueType&& val) noexcept(
template <typename BasicJsonType, typename ValueType>
static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(
noexcept(::nlohmann::to_json(j, std::forward<ValueType>(val))))
-> decltype(::nlohmann::to_json(j, std::forward<ValueType>(val)),
void())
{
::nlohmann::to_json(j, std::forward<ValueType>(val));
}