💩 first try on #1045
This commit is contained in:
		
							parent
							
								
									acf10d9af7
								
							
						
					
					
						commit
						8d8f890771
					
				
					 3 changed files with 55 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
 | 
			
		||||
#include <cstddef> // size_t
 | 
			
		||||
#include <string> // string, to_string
 | 
			
		||||
#include <iterator> // input_iterator_tag
 | 
			
		||||
 | 
			
		||||
#include <nlohmann/detail/value_t.hpp>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -16,6 +17,13 @@ template<typename IteratorType> class iteration_proxy
 | 
			
		|||
    /// helper class for iteration
 | 
			
		||||
    class iteration_proxy_internal
 | 
			
		||||
    {
 | 
			
		||||
      public:
 | 
			
		||||
        using difference_type = std::ptrdiff_t;
 | 
			
		||||
        using value_type = iteration_proxy_internal;
 | 
			
		||||
        using pointer = iteration_proxy_internal*;
 | 
			
		||||
        using reference = iteration_proxy_internal&;
 | 
			
		||||
        using iterator_category = std::input_iterator_tag;
 | 
			
		||||
 | 
			
		||||
      private:
 | 
			
		||||
        /// the iterator
 | 
			
		||||
        IteratorType anchor;
 | 
			
		||||
| 
						 | 
				
			
			@ -25,6 +33,9 @@ template<typename IteratorType> class iteration_proxy
 | 
			
		|||
      public:
 | 
			
		||||
        explicit iteration_proxy_internal(IteratorType it) noexcept : anchor(it) {}
 | 
			
		||||
 | 
			
		||||
        iteration_proxy_internal(const iteration_proxy_internal&) = default;
 | 
			
		||||
        iteration_proxy_internal& operator=(const iteration_proxy_internal&) = default;
 | 
			
		||||
 | 
			
		||||
        /// dereference operator (needed for range-based for)
 | 
			
		||||
        iteration_proxy_internal& operator*()
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -40,6 +51,12 @@ template<typename IteratorType> class iteration_proxy
 | 
			
		|||
            return *this;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// equality operator (needed for InputIterator)
 | 
			
		||||
        bool operator==(const iteration_proxy_internal& o) const noexcept
 | 
			
		||||
        {
 | 
			
		||||
            return anchor == o.anchor;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// inequality operator (needed for range-based for)
 | 
			
		||||
        bool operator!=(const iteration_proxy_internal& o) const noexcept
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue