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.
This commit is contained in:
Andrey Semashev
2025-06-09 02:36:26 +03:00
parent 3767696513
commit 7e3e9a584e

View File

@ -374,8 +374,7 @@ template< typename ValueType, typename Reference >
struct use_operator_brackets_proxy : struct use_operator_brackets_proxy :
public detail::negation< public detail::negation<
detail::conjunction< detail::conjunction<
std::is_copy_constructible< ValueType >, std::is_trivially_copyable< ValueType >,
std::is_trivial< ValueType >,
iterator_writability_disabled< ValueType, Reference > iterator_writability_disabled< ValueType, Reference >
> >
> >
@ -385,14 +384,14 @@ template< typename Iterator, typename Value, typename Reference >
struct operator_brackets_result struct operator_brackets_result
{ {
using type = typename std::conditional< using type = typename std::conditional<
use_operator_brackets_proxy<Value, Reference>::value, use_operator_brackets_proxy< Value, Reference >::value,
operator_brackets_proxy<Iterator>, operator_brackets_proxy< Iterator >,
Value Value
>::type; >::type;
}; };
template< typename Iterator > template< typename Iterator >
inline operator_brackets_proxy<Iterator> make_operator_brackets_result(Iterator const& iter, std::true_type) inline operator_brackets_proxy< Iterator > make_operator_brackets_result(Iterator const& iter, std::true_type)
{ {
return operator_brackets_proxy< Iterator >(iter); return operator_brackets_proxy< Iterator >(iter);
} }