Use SFINAE to disable operator_brackets_proxy assignment operator is reference
is not assignable from the assignment argument. Also fix the iterator type
in std::declval in noexcept specification.
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.
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.
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.
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.
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.
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.
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.
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.