The recent commit 5777e9944b broke code such as
(*it++).foo(), where the result of dereferencing would be convertible to
the value type but did not provide the members of the value type. To mitigate
this, return a reference to the value instead of a proxy object. This will only
work for non-writable iterators (and it didn't work for writable iterators
before either) because in that case a proxy is needed to be able to intercept
operator=.
Also fix a similar issue with (it++)->foo() by adding operator-> overloads
to the post-increment result proxies.
Added tests for the fixes.
This allows expressions such as `Iterator it2(it1++)` to compile.
Additionally separated operations that are allowed on the result of
dereferencing the proxy to a separate set of proxies to make the allowed
set of expressions more strict and unambiguous. In particular, it means
`it++` cannot be converted to value type and `*it++` cannot be converted
to the iterator type anymore. Also, make sure `*it1++ = *it2++` works
as expexted by explicitly converting the proxy to the value type on
assignment.
Fixes https://github.com/boostorg/iterator/issues/75.
A comment in boost/iterator.hpp and boost/detail/iterator.hpp mentions that
the files are obsolete and will be deprecated. All they do is pull some types
from namespace std into namespace boost.
A comment in boost/iterator.hpp and boost/detail/iterator.hpp mentions that
the files are obsolete and will be deprecated. All they do is pull some types
from namespace std into namespace boost.
Some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject
'reference-to-reference' in the template and typedef which described
in CWG DR106 [1].
In such situations, iterator_facade rejects reference type as a value
type and some special iterators will become ill-formed:
the test libs/range/test/join.hpp might be descriptive.
[1] http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106
Signed-off-by: Kohei Takahashi <flast@flast.jp>
This change excludes boost:: and boost::detail:: namespaces from ADL for unqualified function calls (e.g. algorithms). This reduces the possibility of name clashes with other libraries and user's code. One of the effects should be fixing test failures on gcc 4.2 and 4.4 due to clashed with Boost.TypeTraits.
Also some of the functions marked with inline keyword.
This makes iterators defined using iterator_facade more friendly to type inspection and fixes its use with next()/prior() since commit 651a869d4f.
The arithmetic, indexing and relational operators are only defined if the iterator category or traversal permits that. Note that the implementation requires partial template specialization support now.
Reverted: 2e099caceb9..21102938e8ccb
I'm going to reapply some of them soon, but it's easier to revert them
all first, as there are conflicts. Also the number of changes that were
inserted since then, mean that there would be a huge gap between related
changes.
- The logic for determining the result of iterator_facade::operator[] has been factored out into a separate detail header in preparation for its potential use in iterator_range to avoid iterator_range::operator[] from returning a reference to a temporary.
[SVN r80901]
immutability of the pointed-to type via const qualification. The
pointee of a proxy-based iterator will be const qualified unless a
mutable reference to the value_type can be bound to the returned
proxy.
Added a test for pointee
Fixed iterator_facade so operator[] result type computation didn't
cause a problem with abstract types.
Updated iterator_facade operator[] docs for accuracy.
Allowed Borland to simply fail the indirect_iterator_member_types test
because of its lame const-dropping, instead of trying to work around
it.
[SVN r21579]