| 3839 | target = to_string(value); |
| 3840 | } |
| 3841 | template<typename IteratorType> class iteration_proxy_value |
| 3842 | { |
| 3843 | public: |
| 3844 | using difference_type = std::ptrdiff_t; |
| 3845 | using value_type = iteration_proxy_value; |
| 3846 | using pointer = value_type*; |
| 3847 | using reference = value_type&; |
| 3848 | using iterator_category = std::input_iterator_tag; |
| 3849 | using string_type = typename std::remove_cv< typename std::remove_reference<decltype(std::declval<IteratorType>().key()) >::type >::type; |
| 3850 | |
| 3851 | private: |
| 3852 | /// the iterator |
| 3853 | IteratorType anchor; |
| 3854 | /// an index for arrays (used to create key names) |
| 3855 | std::size_t array_index = 0; |
| 3856 | /// last stringified array index |
| 3857 | mutable std::size_t array_index_last = 0; |
| 3858 | /// a string representation of the array index |
| 3859 | mutable string_type array_index_str = "0"; |
| 3860 | /// an empty string (to return a reference for primitive values) |
| 3861 | const string_type empty_str = ""; |
| 3862 | |
| 3863 | public: |
| 3864 | explicit iteration_proxy_value(IteratorType it) noexcept : anchor(it) {} |
| 3865 | |
| 3866 | /// dereference operator (needed for range-based for) |
| 3867 | iteration_proxy_value& operator*() |
| 3868 | { |
| 3869 | return *this; |
| 3870 | } |
| 3871 | |
| 3872 | /// increment operator (needed for range-based for) |
| 3873 | iteration_proxy_value& operator++() |
| 3874 | { |
| 3875 | ++anchor; |
| 3876 | ++array_index; |
| 3877 | |
| 3878 | return *this; |
| 3879 | } |
| 3880 | |
| 3881 | /// equality operator (needed for InputIterator) |
| 3882 | bool operator==(const iteration_proxy_value& o) const |
| 3883 | { |
| 3884 | return anchor == o.anchor; |
| 3885 | } |
| 3886 | |
| 3887 | /// inequality operator (needed for range-based for) |
| 3888 | bool operator!=(const iteration_proxy_value& o) const |
| 3889 | { |
| 3890 | return anchor != o.anchor; |
| 3891 | } |
| 3892 | |
| 3893 | /// return key of the iterator |
| 3894 | const string_type& key() const |
| 3895 | { |
| 3896 | JSON_ASSERT(anchor.m_object != nullptr); |
| 3897 | |
| 3898 | switch (anchor.m_object->type()) |
nothing calls this directly
no test coverage detected