MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / iter_impl

Class iter_impl

Source/external/json.hpp:12833–13021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12831*/
12832template<typename BasicJsonType>
12833class iter_impl // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions)
12834{
12835 /// the iterator with BasicJsonType of different const-ness
12836 using other_iter_impl = iter_impl<typename std::conditional<std::is_const<BasicJsonType>::value, typename std::remove_const<BasicJsonType>::type, const BasicJsonType>::type>;
12837 /// allow basic_json to access private members
12838 friend other_iter_impl;
12839 friend BasicJsonType;
12840 friend iteration_proxy<iter_impl>;
12841 friend iteration_proxy_value<iter_impl>;
12842
12843 using object_t = typename BasicJsonType::object_t;
12844 using array_t = typename BasicJsonType::array_t;
12845 // make sure BasicJsonType is basic_json or const basic_json
12846 static_assert(is_basic_json<typename std::remove_const<BasicJsonType>::type>::value,
12847 "iter_impl only accepts (const) basic_json");
12848 // superficial check for the LegacyBidirectionalIterator named requirement
12849 static_assert(std::is_base_of<std::bidirectional_iterator_tag, std::bidirectional_iterator_tag>::value
12850 && std::is_base_of<std::bidirectional_iterator_tag, typename std::iterator_traits<typename array_t::iterator>::iterator_category>::value,
12851 "basic_json iterator assumes array and object type iterators satisfy the LegacyBidirectionalIterator named requirement.");
12852
12853 public:
12854 /// The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17.
12855 /// The C++ Standard has never required user-defined iterators to derive from std::iterator.
12856 /// A user-defined iterator should provide publicly accessible typedefs named
12857 /// iterator_category, value_type, difference_type, pointer, and reference.
12858 /// Note that value_type is required to be non-const, even for constant iterators.
12859 using iterator_category = std::bidirectional_iterator_tag;
12860
12861 /// the type of the values when the iterator is dereferenced
12862 using value_type = typename BasicJsonType::value_type;
12863 /// a type to represent differences between iterators
12864 using difference_type = typename BasicJsonType::difference_type;
12865 /// defines a pointer to the type iterated over (value_type)
12866 using pointer = typename std::conditional<std::is_const<BasicJsonType>::value,
12867 typename BasicJsonType::const_pointer,
12868 typename BasicJsonType::pointer>::type;
12869 /// defines a reference to the type iterated over (value_type)
12870 using reference =
12871 typename std::conditional<std::is_const<BasicJsonType>::value,
12872 typename BasicJsonType::const_reference,
12873 typename BasicJsonType::reference>::type;
12874
12875 iter_impl() = default;
12876 ~iter_impl() = default;
12877 iter_impl(iter_impl&&) noexcept = default;
12878 iter_impl& operator=(iter_impl&&) noexcept = default;
12879
12880 /*!
12881 @brief constructor for a given JSON instance
12882 @param[in] object pointer to a JSON object for this iterator
12883 @pre object != nullptr
12884 @post The iterator is initialized; i.e. `m_object != nullptr`.
12885 */
12886 explicit iter_impl(pointer object) noexcept : m_object(object)
12887 {
12888 JSON_ASSERT(m_object != nullptr);
12889
12890 switch (m_object->m_type)

Callers

nothing calls this directly

Calls 3

beginMethod · 0.80
set_endMethod · 0.80
set_beginMethod · 0.80

Tested by

no test coverage detected