Subject: [Boost-bugs] [Boost C++ Libraries] #12071: postfix_increment_proxy is not DefaultConstructible and doesn't have a nested public value_type
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-03-16 15:36:58
#12071: postfix_increment_proxy is not DefaultConstructible and doesn't have a
nested public value_type
---------------------------------------------+-----------------------------
Reporter: Krzysztof CzaiÅski <1czajnik@â¦> | Owner:
Type: Bugs | jeffrey.hellrung
Milestone: To Be Determined | Status: new
Version: Boost 1.61.0 | Component: iterator
Keywords: range-v3 | Severity: Problem
---------------------------------------------+-----------------------------
The fact that {{{postfix_increment_proxy}}} is not
{{{DefaultConstructible}}} and doesn't have a nested public
{{{value_type}}} makes iterators unusable with range-v3, which check the
concepts.
Example:
{{{
#include "boost/iterator/iterator_facade.hpp"
#include "range/v3/utility/iterator.hpp"
template <class V, class Category>
class TestIter
: public boost::iterator_facade<TestIter<V, Category>, V, Category, V>
{
public:
using typename boost::iterator_facade<TestIter<V, Category>, V,
Category,
V>::difference_type;
TestIter() : v_() {}
explicit TestIter(V v) : v_(v) {}
private:
friend class boost::iterator_core_access;
V dereference() const { return v_; }
bool equal(const TestIter& other) const { return v_ == other.v_; }
void increment() { ++v_; }
void decrement() { --v_; }
void advance(difference_type n) { v_ += n; }
difference_type distance_to(const TestIter& other) const {
return other.v_ - v_;
}
V v_;
};
using InIter = TestIter<int, std::input_iterator_tag>;
static_assert(ranges::InputIterator<InIter>(), "");
void f(InIter x) {
static_assert(ranges::Readable<decltype(x++)>(), "");
static_assert(ranges::DefaultConstructible<decltype(x++)>(), "");
}
}}}
I think {{{static_assert(ranges::InputIterator<InIter>(), "")}}} fails,
because the two static_asserts in {{{f()}}} fail.
From what I've learned here:
https://github.com/ericniebler/range-v3/issues/304
it seems a good idea to fix {{{postfix_increment_proxy}}} to conform to
these requirements. Ditto {{{writable_postfix_increment_proxy}}}.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12071> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC