add detail/iterators/internal_iterator.hpp

This commit is contained in:
Théo DELRIEU 2017-08-14 17:18:07 +02:00
parent 51ecc31db7
commit 3e65a65290
No known key found for this signature in database
GPG key ID: 51AC4B3A2C47C10F
3 changed files with 31 additions and 17 deletions

View file

@ -13,7 +13,8 @@ SRCS = ${SRCDIR}/json.hpp \
${SRCDIR}/detail/parsing/input_adapters.hpp \ ${SRCDIR}/detail/parsing/input_adapters.hpp \
${SRCDIR}/detail/parsing/lexer.hpp \ ${SRCDIR}/detail/parsing/lexer.hpp \
${SRCDIR}/detail/parsing/parser.hpp \ ${SRCDIR}/detail/parsing/parser.hpp \
${SRCDIR}/detail/iterators/primitive_iterator.hpp ${SRCDIR}/detail/iterators/primitive_iterator.hpp \
${SRCDIR}/detail/iterators/internal_iterator.hpp

View file

@ -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<typename BasicJsonType> 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

View file

@ -61,6 +61,7 @@ SOFTWARE.
#include "detail/parsing/lexer.hpp" #include "detail/parsing/lexer.hpp"
#include "detail/parsing/parser.hpp" #include "detail/parsing/parser.hpp"
#include "detail/iterators/primitive_iterator.hpp" #include "detail/iterators/primitive_iterator.hpp"
#include "detail/iterators/internal_iterator.hpp"
/*! /*!
@brief namespace for Niels Lohmann @brief namespace for Niels Lohmann
@ -75,22 +76,6 @@ namespace detail
// iterators // // 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<typename BasicJsonType> 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<typename IteratorType> class iteration_proxy; template<typename IteratorType> class iteration_proxy;
/*! /*!