240 Commits

Author SHA1 Message Date
Andrey Semashev
80bb1ac9e4 Avoid including <utility>, added a missing include. 2023-06-22 21:14:03 +03:00
Brian Weed
d11499c08c Performance improvement: (#79)
Performance improvement: Add move semantics to by-value parameters (iterator and predicate), to eliminate the cost of copy-construction. Both the Predicate (Normally a std::function, or lambda), and custom iterators can have state, which can be expensive to copy. Profiler identified this as a bottleneck while using boost::adaptors::filtered.
2023-06-22 21:06:19 +03:00
Andrey Semashev
85b542e1b6 Extracted is_iterator trait to a separate header.
Also, reworked is_iterator to be more robust against various corner cases
and added dedicated tests for the type trait.
2023-05-21 15:18:54 +03:00
Alexander Grund
e8fbd92a61 Use BOOST_STATIC_ASSERT instead of BOOST_MPL_ASSERT (#78)
The MPL version is slower to compile and `BOOST_STATIC_ASSERT` is
already used in some places. So unify that.

This also fixes `Wzero-as-null-pointer-constant` warnings, see https://github.com/boostorg/mpl/pull/75
2023-05-07 15:23:16 +03:00
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
853ba3d3c7 Use the proper derived type of the function_input_iterator in iterator_facade.
This fixes incorrect final iterator type being used in iterator_facade, which
results in an internal base class being returned from various facade methods.

Reported in https://github.com/boostorg/iterator/issues/75.
2022-11-09 21:15:44 +03:00
Andrey Semashev
a3269e536f Include remove_reference.hpp only when needed. 2022-07-01 00:23:19 +03:00
Andrey Semashev
1a80896934 Disabled assignment of output_proxy to output_proxy. 2022-07-01 00:13:32 +03:00
Andrey Semashev
ee2d3a6596 Made output_proxy private and made its internals private. 2022-06-30 23:35:58 +03:00
Andrey Semashev
cd24487161 Removed #include <utility>. 2022-06-30 23:26:52 +03:00
Andrey Semashev
dd37a27067 Marked output_proxy constructor explicit. 2022-06-30 23:25:33 +03:00
jakob lovhall
c924b42749 add forward reference assignment operator to function_output_iterator 2022-06-30 15:40:41 +02:00
Andrey Semashev
d175ba2450 Trim trailing spaces. 2022-01-13 17:32:11 +03:00
Andrey Semashev
75ba1a50c9 Switched enable_if from MPL to TypeTraits. 2022-01-13 17:28:53 +03:00
Andrey Semashev
e4ab917f79 Removed unneeded includes and added missing ones to transform_iterator. 2022-01-13 17:27:22 +03:00
Andrey Semashev
c901bd6d7a Switched function_input_iterator to TypeTraits instead of MPL. 2022-01-13 17:08:55 +03:00
Andrey Semashev
eb0d01126a Added support for int128 to counting_iterator. 2022-01-13 16:59:46 +03:00
Andrey Semashev
abe6fbfd4b Converted counting_iterator to rely on TypeTraits instead of MPL. 2022-01-13 16:57:52 +03:00
Andrey Semashev
7a200905dd Added an assignment operator to counting_iterator.
This should silence gcc warnings about deprecated implicit copy assignment
operator because of the explicitly defined copy constructor. Also, changed
constructor definitions to be defaulted when possible and added missing
includes.

Closes https://github.com/boostorg/iterator/pull/69.
2022-01-13 16:34:47 +03:00
joaquintides
6dfb175cef supressed spurious type-limits warning
See https://github.com/boostorg/iterator/pull/66 for details.
2021-08-31 19:19:57 +02:00
Edward Diener
dc7bf5cc05 Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-31 11:21:59 -04:00
Glen Fernandes
2af5a16539 Use use_default from Boost.Core
boost::use_default is now defined in Core for multiple Boost libraries.
2019-02-22 17:17:52 -05:00
Andrey Semashev
bb1efd3370 Updated addressof.hpp include path. 2018-11-14 12:42:24 +03:00
Andrey Semashev
6ab148be01 Revert "Revert "Replace using-declarations with using-directives to avoid ADL issues.""
This reverts commit 06875a754d.

The suggested fix for build failures need to be applied to Boost.Range:

https://github.com/boostorg/range/pull/75
2018-09-23 12:28:03 +03:00
Andrey Semashev
06875a754d Revert "Replace using-declarations with using-directives to avoid ADL issues."
This reverts commit 44cee00831.

The commit reportedly broke building Boost and quickbook.

b844c8df53 (commitcomment-30603668)
2018-09-22 18:46:36 +03:00
morinmorin
194087e8ca Merge branch 'develop' into fix/unwanted_adl 2018-09-22 20:47:10 +09:00
morinmorin
44cee00831 Replace using-declarations with using-directives to avoid ADL issues. 2018-09-22 20:20:59 +09:00
Daniela Engert
e16f2de233 Inheriting std::iterator is deprecated in c++17.
Boost's iterator.hpp is deprecated, too. Therefore get rid of all of that and replace inheritance by lifting std::iterator's members into the derived class.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2017-12-27 09:32:51 +01:00
Andrey Semashev
8b5e92a0c4 Converted asserts in tests to tests using lightweight_test.hpp. 2017-10-02 01:26:39 +03:00
Andrey Semashev
0a08203107 Replaced type_traits.hpp with more fine grained includes.
This should work around compilation failures on gcc 4.6, which apparently
cannot handle all headers in Boost.TypeTraits.
2017-09-30 15:56:53 +03:00
Andrey Semashev
a85dfaa7f2 Added a forwarding header for function_output_iterator.hpp 2017-09-18 01:43:24 +03:00
Andrey Semashev
2af60e066d Move function_output_iterator.hpp into the iterator directory. 2017-09-18 01:39:00 +03:00
morinmorin
c338572735 Fix usage of decltype-based result_of in transform_iterator.
Regardless of value categories of a transform_iterator object, its
dereference operator calls m_f as an lvalue. Thus, correct usage of
decltype-based result_of is result_of<const UnaryFunc&(...)>.
2017-09-16 18:01:03 +09:00
morinmorin
d058933767 Correct the result_of usage. 2017-09-12 02:54:50 +09:00
morinmorin
553b9713ac Remove dead class template (i.e. function_reference_input_iterator).
Both make_function_input_iterator(function) and make...(&function)
do not depend on function_reference_input_iterator. Actually, passing a
function reference as a template argument to function_input_iterator is
not supported. Doing so results in compiler errors.
2017-09-06 23:12:18 +09:00
morinmorin
ba32745e80 Replace ugly BOOST_DEDUCED_TYPENAME with typename. 2017-09-06 19:50:15 +09:00
morinmorin
282b28e51f Use boost::addressof instead of &. 2017-09-06 19:47:55 +09: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
ed027c2cce Merge branch 'develop'
# Conflicts:
#	include/boost/iterator/reverse_iterator.hpp
2017-07-17 12:03:38 -04:00
Edward Diener
4791425000 Merge pull request #27 from Lastique/advance_generic_distance
Use a separate template parameter for distance in advance().
2017-07-12 12:20:34 -04:00
Andrey Semashev
c148962bd9 Avoid integer overflow on negating distance 2017-07-10 14:57:40 +03:00
Andrey Semashev
5bfbfb7716 Use a separate template parameter for distance in advance().
This follows std::advance interface and also allows to use distance types
other than iterator's difference_type (if the iterator supports that).
2017-07-10 14:51:07 +03:00
Andrey Semashev
26ee5ba754 Remove dependency on boost::prior. 2017-07-09 18:31:06 +03:00
morinmorin
663a30f659 Implement BoostIteratorTraversalConcepts-aware boost::advance/distance 2017-06-29 22:06:12 +09:00
Edward Diener
177f719d15 Merge branch 'develop' 2017-04-24 12:24:21 -04:00
drgler
d7c8cccd64 Bug fix for ticket #12895: Apply remove_reference before remove_cv 2017-03-14 20:45:48 +01:00
Edward Diener
7b627fa679 Merge branch 'develop' 2017-01-04 10:58:14 -05:00
Edward Diener
89d3ec7662 Add inclusion of config.hpp 2016-12-17 19:32:52 -05:00
nekko1119
c09c8ca2b2 Support lambda expressions in function_input_iterator 2015-12-28 02:45:49 +09:00