Commit Graph

483 Commits

Author SHA1 Message Date
Andrey Semashev
e968c3312b Forward dereferencing operators in operator_brackets_proxy.
This allows for expressions like it[n]->foo() and (*it[n]).foo() to compile.
2025-06-09 04:58:45 +03:00
Andrey Semashev
da00617e56 Use perfect forwarding in assignment to operator_brackets_proxy.
Also apply noexcept markup to all of the proxy operators.
2025-06-09 04:58:27 +03:00
Andrey Semashev
7c77e52509 Always use operator_brackets_proxy in iterator_facade.
This avoids returning a copy of the value from operator[], which can
be unexpected by users wanting to obtain an address of the value
referenced by the iterator.

We still want to return a proxy instead of the iterator's reference
since the iterator may be holding the value internally, and the iterator
gets destroyed after returning from operator[], so the returned
reference would be dangling.

Closes https://github.com/boostorg/iterator/issues/61.
2025-06-09 03:22:08 +03:00
Andrey Semashev
7e3e9a584e Replace is_copy_constructible+is_trivial with is_trivially_copyable.
For the purpose of selecting operator[] result type, we don't care
whether the value type is trivially default-constructible. So, in order
to avoid using the deprecated in C++26 is_trivial, use is_trivially_copyable
instead of is_copy_constructible+is_trivial.

Closes https://github.com/boostorg/iterator/issues/93.
2025-06-09 02:36:26 +03:00
Andrey Semashev
1372e9afb6 Fix filter_iterator copy/converting constructor.
The constructed iterator would have an invalid end iterator because of
a typo in storage initialization.

Fixes https://github.com/boostorg/iterator/issues/92.
2025-05-24 23:19:45 +03:00
Andrey Semashev
6428e552e4 Nonessential. 2025-04-23 02:55:50 +03:00
Andrey Semashev
1a7996ebd0 Fixed compilation of filter_iterator conversion constructor.
The constructor would attempt to access a private member of the source
iterator, which could have a different type and therefore have that
member inaccessible. Also, the storage forwarding constructor had incorrect
types used in the forwarding expressions, which caused further compilation
errors.

Fixes https://github.com/boostorg/iterator/issues/90.
2025-04-02 00:09:36 +03:00
Andrey Semashev
a7150173ed Moved shared_container_iterator.hpp in iterator directory, modernized code.
shared_container_iterator now uses std::shared_ptr to store the reference
to the container. boost::shared_ptr is still supported and is wrapped
into std::shared_ptr on construction, so there is overhead due to allocation
of std::shared_ptr state. Going forward, std::shared_ptr is expected
to be the primary use case. As a bonus, this eliminates the dependency
on Boost.SmartPtr.

Moved shared_container_iterator.hpp into the iterator directory and left
a forwarding header for backward compatibility.
2025-02-07 13:36:40 +03:00
Andrey Semashev
e446c6e05c Added indirect_reference_t alias. 2025-02-07 13:36:40 +03:00
Andrey Semashev
8998179e9d Added pointee_t alias. 2025-02-07 13:36:40 +03:00
Andrey Semashev
d35869cd25 Moved generator_iterator.hpp in iterator directory and modernized.
generator_iterator now uses decltype approach to deduce value and reference
types instead of the legacy result_type typedef, which was required to be
defined by the generator function.

The default constructor of generator_iterator now value initializes its
data members to avoid using uninitialized data.
2025-02-07 13:36:33 +03:00
Andrey Semashev
6e6def930f Modernized transform_iterator.hpp, use EBO to store the transform function. 2025-02-07 01:17:55 +03:00
Andrey Semashev
1a58ca89d1 Reformatted reverse_iterator.hpp. 2025-02-07 01:17:55 +03:00
Andrey Semashev
34f703cfb6 Removed workarounds for older compilers from permutation_iterator.hpp. 2025-02-07 01:17:55 +03:00
Andrey Semashev
a91fc06bb4 Prohibit default construction of function_output_iterator on function pointers.
Default-constructed function_output_iterator with function pointers is unusable
and previously would have contained an uninitialized function pointer.
Disable the default constructor using SFINAE to prevent misuse.

Also reformat code.
2025-02-07 01:17:55 +03:00
Andrey Semashev
fd1445140f Removed usage of FunctionTypes in function_input_iterator.hpp.
This effectively removes usage of MPL in function_input_iterator.hpp and
also simplifies implementation.
2025-02-07 01:17:50 +03:00
Andrey Semashev
8c2fdf6053 Use variadic template expansion in min category deduction in zip_iterator.
This results in marginally faster compile times in modern code bases
where tuples are variadic.
2025-02-06 01:47:49 +03:00
Andrey Semashev
aadd90df45 Removed direct usage of MPL from zip_iterator.hpp.
MPL is still used through Boost.Fusion, but that is a matter of
optimizing Boost.Fusion now.
2025-02-06 01:47:49 +03:00
Andrey Semashev
dc57bcf319 Modernized filter_iterator.hpp.
Use EBO to minimize wasted storage space if the predicate is an empty class.

Disable default constructing non-class predicates using SFINAE instead
of a static_assert. This will help type traits like is_constructible,
when applied to the iterator type.
2025-02-06 01:47:49 +03:00
Andrey Semashev
baf6d06cc2 Modernized iterator_traits.hpp.
Added *_t type traits and removed an oudated macro that was used with
ancient compilers.
2025-02-06 01:47:49 +03:00
Andrey Semashev
6e60ea7a88 Extracted and unified default template parameter handling helpers.
The new eval_if_default helper replaces both ia_dflt_help and
ia_eval_if_default helpers. Additionally, added a new if_default
helper, which expands to the type or the default parameter directly.

The new helpers are placed in separate headers which can be used
without the iterator_adaptor template.
2025-02-06 01:47:43 +03:00
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