make to_json SFINAE-correct

This commit is contained in:
Théo DELRIEU committed 2018-09-07 12:18:04 +02:00
1 parent f7c8a2145a
commit f7971f04a5
3 files changed
+22 -58

No files matched your search

+4 -2
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));
}