diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp index 63921ca55..6c6f56d1e 100644 --- a/include/nlohmann/detail/input/input_adapters.hpp +++ b/include/nlohmann/detail/input/input_adapters.hpp @@ -372,7 +372,7 @@ typename iterator_input_adapter_factory::adapter_type input_adapte // Convenience shorthand from container to iterator template -auto input_adapter(const ContainerType& container) -> decltype(input_adapter(begin(container), end(container))) +typename iterator_input_adapter_factory::adapter_type input_adapter(const ContainerType& container) { // Enable ADL using std::begin; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 9e6f6012d..e5f415670 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -5179,7 +5179,7 @@ typename iterator_input_adapter_factory::adapter_type input_adapte // Convenience shorthand from container to iterator template -auto input_adapter(const ContainerType& container) -> decltype(input_adapter(begin(container), end(container))) +typename iterator_input_adapter_factory::adapter_type input_adapter(const ContainerType& container) { // Enable ADL using std::begin; @@ -16793,7 +16793,7 @@ class basic_json detail::parser_callback_tcb = nullptr, const bool allow_exceptions = true, const bool ignore_comments = false - ) + ) { return ::nlohmann::detail::parser(std::move(adapter), std::move(cb), allow_exceptions, ignore_comments); @@ -25338,7 +25338,7 @@ template<> inline void swap(nlohmann::json& j1, nlohmann::json& j2) noexcept( is_nothrow_move_constructible::value&& is_nothrow_move_assignable::value - ) +) { j1.swap(j2); } diff --git a/test/src/unit-user_defined_input.cpp b/test/src/unit-user_defined_input.cpp index 5a1138b00..507f7206e 100644 --- a/test/src/unit-user_defined_input.cpp +++ b/test/src/unit-user_defined_input.cpp @@ -50,6 +50,8 @@ TEST_CASE("Use arbitrary stdlib container") struct MyContainer { + using iterator = const char*; + using const_iterator = iterator; const char* data; };