Commit Graph

462 Commits

Author SHA1 Message Date
Andrey Semashev
cb81a1dfc3 Extracted enable_if_convertible trait to a separate header.
Keep including the new header in iterator_adaptor.hpp for backward
compatibility, until downstream users are updated to include the new
header.
2025-02-06 01:38:24 +03:00
Andrey Semashev
c22af90b60 Reformat advance.hpp and distance.hpp. 2025-02-06 01:38:24 +03:00
Andrey Semashev
b6a41e325c Added a missing include in interoperable.hpp. 2025-02-06 01:38:24 +03:00
Andrey Semashev
0c2eda4bb8 Removed MPL usage from indirect_iterator.hpp. 2025-02-06 01:38:16 +03:00
Andrey Semashev
b12874b6ca Removed MPL usage from iterator_facade.hpp. 2025-02-05 18:51:44 +03:00
Andrey Semashev
1875d95019 Removed MPL usage from iterator_adaptor.hpp. 2025-02-05 18:51:44 +03:00
Andrey Semashev
4f5f61e37b Slightly optimized iterator_facade_default_category compilation speed. 2025-02-05 18:51:44 +03:00
Andrey Semashev
5aa1c9fef3 Removed workarounds for older compilers from is_readable_iterator.hpp. 2025-02-05 18:51:44 +03:00
Andrey Semashev
d6a68dc6eb Removed workarounds for older compilers from counting_iterator.hpp. 2025-02-05 18:51:44 +03:00
Andrey Semashev
e5ee9a6168 Removed unneeded include. 2025-02-05 18:51:44 +03:00
Andrey Semashev
82703b7c14 Moved input_output_iterator_tag to unit tests.
The class was not used anywhere else and was an implementation detail.
2025-02-05 18:51:44 +03:00
Andrey Semashev
d8ce9ddfc7 Removed MPL usage from facade_iterator_category.hpp. 2025-02-05 18:51:44 +03:00
Andrey Semashev
5f713e9b14 Use std::type_identity when possible in counting_iterator.hpp. 2025-02-05 18:51:44 +03:00
Andrey Semashev
12ee53d441 Added type_identity forwarding header. 2025-02-05 18:51:44 +03:00
Andrey Semashev
ef40faf620 Replaced leftover boost::true/false_type with std in counting_iterator.hpp.
Also made (unsigned) long long support mandatory.
2025-02-05 18:51:44 +03:00
Andrey Semashev
fc99b7a15d Added missing includes for use_default. 2025-02-05 18:51:44 +03:00
Andrey Semashev
241c28018e Converted leftover boost::true/false_type to std in iterator_facade.hpp. 2025-02-05 18:51:44 +03:00
Andrey Semashev
83905b219e Reduced dependency on MPL in iterator_categories.hpp.
Also simplified implementation of type traits using Boost.MP11.
2025-02-05 18:51:44 +03:00
Andrey Semashev
6fab3bbfa4 Removed dependency on MPL from is_lvalue_iterator.hpp.
Also removed workarounds for older compilers and simplified implementation.
2025-02-05 18:51:44 +03:00
Andrey Semashev
dec7d0f24c Extracted min_category as a variadic metafunction.
The new min_category is similar to minimum_category but accepts variable
number of iterator categories on input instead of just two, and also does
not depend on Boost.MPL for lambda placeholders. The existing minimum_category
trait has been reimplemented in terms of min_category and deprecated.

We don't yet emit deprecation warnings as there is still code that uses
the old trait which we first need to update. Eventually, minimum_category
will emit warnings and will be removed.
2025-02-05 18:51:37 +03:00
Andrey Semashev
b30cbf634c Reduced dependency on MPL in minimum_category.hpp. 2025-01-26 20:00:53 +03:00
Andrey Semashev
7ddbf15868 Removed MPL usage from iterator_archetypes.hpp. 2025-01-26 19:08:40 +03:00
Andrey Semashev
4fc0165034 Removed support for ancient complilers for MPL lambdas in is_readable_iterator. 2025-01-26 17:58:48 +03:00
Andrey Semashev
bcf94f9e5d Removed MPL usage from pointee and indirect_reference. 2025-01-26 17:57:47 +03:00
Andrey Semashev
d6297a553b Removed the BOOST_ITERATOR_CONVERTIBLE helper macro. 2025-01-26 15:55:52 +03:00
Andrey Semashev
32d19a72e1 Trim trailing spaces. 2025-01-26 15:45:03 +03:00
Andrey Semashev
cf43da4286 Removed useless #if 1. 2025-01-26 15:42:30 +03:00
Andrey Semashev
10e89b3e4c Restored brace formatting in new_iterator_tests.hpp. 2025-01-26 15:25:28 +03:00
Georgy Guminov
f9effffb6d Mostly remove pre-CXX11 workarounds.
С++03 support was deprecated in 1.85 and now can be removed. This PR clears
many of workarounds, which are no longer needed now.

* Remove unused workaround macros (many of).
* Remove BOOST_STATIC_ASSERT usages.
* Minimize Boost::type_traits dependency (in favour of STL's type_traits).

Closes https://github.com/boostorg/iterator/pull/82.

Squashed commit of the following:

commit 741a627b73
Author: Georgy Guminov <gogagum@gmail.com>
Date:   Sat Jan 25 12:13:05 2025 +0300

    Replace testers with standard metafunctions.

commit bf4cce6114
Author: Georgy Guminov <gogagum@gmail.com>
Date:   Sat Jan 25 11:51:32 2025 +0300

    Refactor is_lvalue_iterator.hpp.

commit 8d080c6c58
Author: Georgy Guminov <gogagum@gmail.com>
Date:   Sat Jan 25 10:27:32 2025 +0300

    Remove more workarounds.

commit 5a4ba24d36
Author: Georgy Guminov <gogagum@gmail.com>
Date:   Sun Jan 19 16:38:30 2025 +0300

    Fixes.

commit fdfafce2b9
Author: Georgy Guminov <gogagum@gmail.com>
Date:   Sat Oct 26 15:06:43 2024 +0300

    Remove BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
    Correct static_assert messages.
    Fix messages & replace is_standard_layout with is_copy_constructible.

commit c69ac1408a
Author: Georgy Guminov <gogagum@gmail.com>
Date:   Sat Oct 26 14:48:51 2024 +0300

    Correct static_assert messages.

commit b5df827151
Author: Georqy Guminov <gogagum@gmail.com>
Date:   Sun Jun 23 16:12:29 2024 +0300

    Fixes. Remove some Boost.MPL usages. Remove unused includes.

commit 01fd35e9f8
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Wed Jun 12 17:14:21 2024 +0300

    abstract conjunction.

commit c02def8acf
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Wed Jun 12 16:35:43 2024 +0300

    return addressof & conjunction.

commit 3b3d162575
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Wed Jun 12 16:30:44 2024 +0300

    Make macro more readable.

commit 4ab19e045f
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Wed Jun 12 15:56:49 2024 +0300

    Add static_assert messages.

commit 82b5c44cd3
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Wed Jun 12 14:12:10 2024 +0300

    Return is iterator CXX17 test.

commit 2d58d65462
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Tue Jun 11 14:04:17 2024 +0300

    Omitted.

commit a0d04d9491
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Tue Jun 11 14:00:35 2024 +0300

    Replace move with static_cast

commit 4a49b8a1a2
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Mon Jun 10 21:38:53 2024 +0300

    Return BOOST_NOEXCEPT

commit 054c013bba
Author: Georgiy Guminov <gogagum@gmail.com>
Date:   Sun Jun 9 15:20:41 2024 +0300

    CXX11
2025-01-26 15:21:16 +03:00
Andrey Semashev
7c55a6cef8 Marked output_proxy assignment as const.
This is also required for compliance with std::output_iterator concept.
2024-10-11 00:34:28 +03:00
Andrey Semashev
e4eaeeac44 Make function_output_iterator compliant with std::output_iterator concept.
Fixes https://github.com/boostorg/iterator/issues/85.
Closes https://github.com/boostorg/iterator/pull/87.
2024-10-11 00:26:30 +03:00
Andrey Semashev
a9dabd3c65 Removed dependency on Boost.Conversion in tests.
This reduces the minimum supported compilers versions.
2023-11-17 04:25:29 +03:00
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