From 7e3e9a584e510e3f23ad19d8adf432f1661190b3 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 9 Jun 2025 02:36:26 +0300 Subject: [PATCH] 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. --- include/boost/iterator/iterator_facade.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 2c23fb9..924bcd0 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -374,8 +374,7 @@ template< typename ValueType, typename Reference > struct use_operator_brackets_proxy : public detail::negation< detail::conjunction< - std::is_copy_constructible< ValueType >, - std::is_trivial< ValueType >, + std::is_trivially_copyable< ValueType >, iterator_writability_disabled< ValueType, Reference > > > @@ -385,14 +384,14 @@ template< typename Iterator, typename Value, typename Reference > struct operator_brackets_result { using type = typename std::conditional< - use_operator_brackets_proxy::value, - operator_brackets_proxy, + use_operator_brackets_proxy< Value, Reference >::value, + operator_brackets_proxy< Iterator >, Value >::type; }; template< typename Iterator > -inline operator_brackets_proxy 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); }