diff --git a/Makefile b/Makefile index 4f5e9249f..d587f051b 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,8 @@ SRCS = ${SRCDIR}/json.hpp \ ${SRCDIR}/detail/parsing/input_adapters.hpp \ ${SRCDIR}/detail/parsing/lexer.hpp \ ${SRCDIR}/detail/parsing/parser.hpp \ - ${SRCDIR}/detail/iterators/primitive_iterator.hpp + ${SRCDIR}/detail/iterators/primitive_iterator.hpp \ + ${SRCDIR}/detail/iterators/internal_iterator.hpp diff --git a/src/detail/iterators/internal_iterator.hpp b/src/detail/iterators/internal_iterator.hpp new file mode 100644 index 000000000..257633557 --- /dev/null +++ b/src/detail/iterators/internal_iterator.hpp @@ -0,0 +1,28 @@ +#ifndef NLOHMANN_JSON_DETAIL_ITERATORS_INTERNAL_ITERATOR_HPP +#define NLOHMANN_JSON_DETAIL_ITERATORS_INTERNAL_ITERATOR_HPP + +#include "detail/iterators/primitive_iterator.hpp" + +namespace nlohmann +{ +namespace detail +{ +/*! +@brief an iterator value + +@note This structure could easily be a union, but MSVC currently does not allow +unions members with complex constructors, see https://github.com/nlohmann/json/pull/105. +*/ +template struct internal_iterator +{ + /// iterator for JSON objects + typename BasicJsonType::object_t::iterator object_iterator {}; + /// iterator for JSON arrays + typename BasicJsonType::array_t::iterator array_iterator {}; + /// generic iterator for all other types + primitive_iterator_t primitive_iterator {}; +}; +} +} + +#endif diff --git a/src/json.hpp b/src/json.hpp index 3d4eddd30..561761dc3 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -61,6 +61,7 @@ SOFTWARE. #include "detail/parsing/lexer.hpp" #include "detail/parsing/parser.hpp" #include "detail/iterators/primitive_iterator.hpp" +#include "detail/iterators/internal_iterator.hpp" /*! @brief namespace for Niels Lohmann @@ -75,22 +76,6 @@ namespace detail // iterators // /////////////// -/*! -@brief an iterator value - -@note This structure could easily be a union, but MSVC currently does not allow -unions members with complex constructors, see https://github.com/nlohmann/json/pull/105. -*/ -template struct internal_iterator -{ - /// iterator for JSON objects - typename BasicJsonType::object_t::iterator object_iterator {}; - /// iterator for JSON arrays - typename BasicJsonType::array_t::iterator array_iterator {}; - /// generic iterator for all other types - primitive_iterator_t primitive_iterator {}; -}; - template class iteration_proxy; /*!