diff --git a/include/boost/iterator/is_lvalue_iterator.hpp b/include/boost/iterator/is_lvalue_iterator.hpp index 3b52e46..3e4b22f 100644 --- a/include/boost/iterator/is_lvalue_iterator.hpp +++ b/include/boost/iterator/is_lvalue_iterator.hpp @@ -6,7 +6,7 @@ #include -#include +#include #include #include @@ -18,47 +18,20 @@ namespace iterators { namespace detail { - // Calling lvalue_preserver( , 0 ) returns a reference - // to the expression's result if is an lvalue, or - // not_an_lvalue() otherwise. - struct not_an_lvalue {}; - - template - T& lvalue_preserver(T&, int); - - template - not_an_lvalue lvalue_preserver(U const&, ...); - // Guts of is_lvalue_iterator. Value is the iterator's value_type // and the result is computed in the nested rebind template. template struct is_lvalue_iterator_impl - { - // Eat implicit conversions so we don't report true for things - // convertible to Value const& - struct conversion_eater - { - conversion_eater(typename std::add_lvalue_reference::type); - }; - - static char tester(conversion_eater, int); - static char (& tester(any_conversion_eater, ...) )[2]; + { + template + using DerefT = decltype(*std::declval()); template - struct rebind + struct rebind : detail::conjunction< + std::is_convertible, typename std::add_lvalue_reference::type> + , std::is_lvalue_reference> + >::type { - static It& x; - - BOOST_STATIC_CONSTANT( - bool - , value = ( - sizeof( - is_lvalue_iterator_impl::tester( - detail::lvalue_preserver(*x,0), 0 - ) - ) == 1 - ) - ); }; };