MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / iter_impl

Class iter_impl

extern/json/json.hpp:12837–13025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

set_endMethod · 0.80
set_beginMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected