59 Commits

Author SHA1 Message Date
Andrey Semashev
7c9b4296a1 Fixed accessing members of the dereferenced value after iterator post-increment.
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.
2022-11-18 00:46:21 +03:00
Andrey Semashev
5777e9944b Added conversion from postfix increment proxy to iterator type.
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.
2022-11-09 21:16:20 +03:00
Andrey Semashev
bb1efd3370 Updated addressof.hpp include path. 2018-11-14 12:42:24 +03:00
Marcel Raad
0107df44ab Remove unused deprecated includes
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.
2017-08-26 20:23:14 +03:00
Edward Diener
22dd100dfd Revert "Remove unused deprecated includes"
This reverts commit b2b9ab1568.
2015-10-15 23:55:35 -04:00
Marcel Raad
b2b9ab1568 Remove unused deprecated includes
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.
2015-09-14 14:28:38 +02:00
Kohei Takahashi
3d3560c12d Avoid 'reference to reference' error in C++03.
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>
2014-09-29 14:58:40 +09:00
Andrey Semashev
dc96d371fa Moved most components of the library to iterators:: namespace.
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.
2014-07-03 00:22:45 +04:00
Andrey Semashev
7fa65a4278 Made iterator operators conditionally defined depending on its category.
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.
2014-06-30 00:05:38 +04:00
Stephen Kelly
6883d083d2 Iterator: Remove obsolete MSVC version checks.
[SVN r86082]

Conflicts:
	include/boost/iterator/iterator_facade.hpp
2014-06-06 23:03:03 +01:00
Daniel James
8e5b8025d8 Revert changes that were merged to master.
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.
2014-06-06 00:56:20 +01:00
Stephen Kelly
220a11883c Remove remaining occurances of BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
These evaded scripting.

[SVN r86249]
2014-06-05 01:14:58 +03:00
Stephen Kelly
01f9b396d8 Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Process #ifdef...#else...#endif blocks.

[SVN r86246]
2014-06-05 01:14:14 +03:00
Stephen Kelly
d853e444ce Iterator: Remove obsolete MSVC version checks.
[SVN r86082]
2014-06-05 01:13:31 +03:00
Jeffrey Lee Hellrung, Jr
d291c7b43e - BREAKING CHANGE: iterator_facade::pointer now corresponds to the actual result of iterator_facade::operator-> rather than Value*. This required an adjustment to a test.
- 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]
2014-06-05 01:11:49 +03:00
Jeffrey Lee Hellrung, Jr.
6d0b2d4f8a Merging trunk to release; fixing typo in comments of iterator_facade.
[SVN r80818]
2012-10-02 13:30:46 +00:00
Jeffrey Lee Hellrung, Jr.
c7fc3470d0 merging from trunk; fix #5127 from M. Morin; fix for refs #5697
[SVN r78184]
2012-04-24 21:28:07 +00:00
Marshall Clow
36565eae63 Merging fixes to release; fixes #2294 fixes #4918 fixes #3645 refs #2823 refs #1427 refs #2893
[SVN r67792]
2011-01-08 18:38:08 +00:00
Nicola Musatti
2ece3ac5c2 CodeGear patch. Fixes #2344
[SVN r49321]
2008-10-13 19:27:26 +00:00
Boris Gubenko
6d0f901b2e merge trunk version (changeset/42064) to release branch
[SVN r42129]
2007-12-17 18:43:36 +00:00
Beman Dawes
23d53055f9 Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41369]
2007-11-25 18:07:19 +00:00
Dave Abrahams
70ef2f0e81 fix for http://tinyurl.com/zuohe
[SVN r35101]
2006-09-13 22:24:14 +00:00
Dave Abrahams
a4e7ba6c28 Fixed definition of iterator_facade_ nested type so derived classes
can use it.  It appears to have never been tested.


[SVN r33297]
2006-03-09 23:09:16 +00:00
Dave Abrahams
e23a647cff Eliminate duplicate inline keyword warnings.
[SVN r32993]
2006-02-18 18:00:26 +00:00
Dave Abrahams
d801e64289 Added some missing "inline" keywords.
[SVN r32992]
2006-02-18 14:34:12 +00:00
John Maddock
ae45f7abf7 Large patch from Ulrich Eckhardt to fix support for EVC++ 4.
[SVN r30670]
2005-08-25 16:27:28 +00:00
Dave Abrahams
a0b28e4c8b Fix for indirect iterators to abstract classes.
[SVN r27625]
2005-03-12 23:10:43 +00:00
Vladimir Prus
1d018cc602 Borland workaround. Replace 'add_const<value_type>::type with
'const value_type' in the code which computed the pointer type. Borland
did not property add const type with 'add_const'.


[SVN r27388]
2005-02-15 12:41:23 +00:00
Dave Abrahams
68268f81eb Stop relying on T(x) to do implicit conversion; it *casts* when T is a builtin!
[SVN r26393]
2004-12-01 16:46:06 +00:00
Aleksey Gurtovoy
6196a6e591 merge new MPL version from 'mplbook' branch
[SVN r24874]
2004-09-02 15:41:37 +00:00
Douglas Gregor
55f8a6380a Moved to BSL
[SVN r24446]
2004-08-12 17:13:07 +00:00
Dave Abrahams
82108581b9 Make sure that X(r++) works for writable iterators.
[SVN r24420]
2004-08-11 19:54:40 +00:00
Rene Rivera
3599398eca Workaround CW8 issues with using static_cast on templates with template ctors.
[SVN r24214]
2004-07-31 22:56:49 +00:00
Dave Abrahams
dd72d599c8 Disable interop properly for vc6/7 using known SFINAE capabilities.
[SVN r24209]
2004-07-31 18:10:00 +00:00
Dave Abrahams
700db48ac7 add nested typedefs
[SVN r23644]
2004-07-16 19:58:03 +00:00
Dave Abrahams
edb7528136 Only use proxy for *r++ if *r is also a proxy.
[SVN r23516]
2004-07-14 00:40:04 +00:00
Dave Abrahams
2721c3c97e Repair postfix increment proxies for input iterators
[SVN r23508]
2004-07-13 17:23:53 +00:00
Dave Abrahams
f49f68c8fe Fixed postfix increment for incrementable and single-pass iterator facade
[SVN r23456]
2004-07-12 03:18:49 +00:00
Dave Abrahams
2a9c00f5b2 Work around CW bug; see http://lists.boost.org/MailArchives/boost/msg57316.php.
[SVN r22655]
2004-04-18 12:23:53 +00:00
Dave Abrahams
8480d452a9 vc6 ICE workarounds,
General simplification for compilers that don't support strict
interop.

Renamed "minus" -> "distance_from".


[SVN r21973]
2004-01-26 14:52:39 +00:00
Dave Abrahams
010f715950 Borland workarounds
[SVN r21893]
2004-01-24 17:39:45 +00:00
Dave Abrahams
a456f8d969 Workaround GCC2 eager instantiation bug.
[SVN r21847]
2004-01-20 19:40:50 +00:00
Dave Abrahams
2bacc663b1 vc6 workaround and a bugfix
[SVN r21799]
2004-01-18 16:17:39 +00:00
Dave Abrahams
c08cc33394 Added thomas' interoperability idea
[SVN r21762]
2004-01-15 17:08:04 +00:00
Dave Abrahams
ff10cfd5dc Fix case of is_pod.hpp
[SVN r21589]
2004-01-11 15:11:52 +00:00
Dave Abrahams
6c62f31f0a Updated pointee and indirect_reference so that pointee represents the
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]
2004-01-11 00:03:09 +00:00
Thomas Witt
2183de96a1 Reverted unwanted checkin.
[SVN r21520]
2004-01-06 19:44:06 +00:00
Thomas Witt
fb1fc6f909 *** empty log message ***
[SVN r21519]
2004-01-06 19:37:17 +00:00
Dave Abrahams
f18906ac6b Removed access category tags from iterator library, made corresponding
changes elsewhere.

boost/iterator and libs/iterator/test were updated from
branch "simplify"


[SVN r20905]
2003-11-22 01:18:37 +00:00
Douglas Gregor
14134e4610 Revert attempted fix for MSVC 6, which broke Borland
[SVN r20618]
2003-11-03 22:04:07 +00:00