Skip to content

Commit 01ac4e1

Browse files
committed
Disable operator_brackets_proxy assignment if reference is not assignable.
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.
1 parent e968c33 commit 01ac4e1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

include/boost/iterator/iterator_facade.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,17 @@ class operator_brackets_proxy
360360

361361
template< typename T >
362362
typename std::enable_if<
363-
!std::is_same<
364-
operator_brackets_proxy< Iterator >,
365-
typename std::remove_cv< typename std::remove_reference< T >::type >::type
363+
detail::conjunction<
364+
detail::negation<
365+
std::is_same<
366+
operator_brackets_proxy< Iterator >,
367+
typename std::remove_cv< typename std::remove_reference< T >::type >::type
368+
>
369+
>,
370+
std::is_assignable< reference, T&& >
366371
>::value,
367372
operator_brackets_proxy&
368-
>::type operator= (T&& val) noexcept(noexcept(*std::declval< Iterator const& >() = std::declval< T&& >()))
373+
>::type operator= (T&& val) noexcept(noexcept(*std::declval< Iterator& >() = std::declval< T&& >()))
369374
{
370375
*m_iter = static_cast< T&& >(val);
371376
return *this;

0 commit comments

Comments
 (0)