<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 24, 2014 at 1:16 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb adM"><div class="">> +/// \brief An iterator type that allows iterating over the pointees via some<br>

> +/// other iterator.<br>
> +///<br>
> +/// The typical usage of this is to expose a type that iterates over Ts, but<br>
> +/// which is implemented with some iterator over T*s:<br>
> +///<br>
> +/// \code<br>
> +///   typedef pointee_iterator<SmallVectorImpl<T *>::iterator> iterator;<br>
> +/// \endcode<br>
> +template <<br>
> +    typename WrappedIteratorT,<br>
> +    typename T = typename std::remove_pointer<<br>
> +        typename std::iterator_traits<WrappedIteratorT>::value_type>::type><br>
<br>
</div></div>Just as a strawman, how do you feel about:<br>
<br>
template <typename WrappedIteratorT, typename T =<br>
decltype(**std::declval<WrappedIteratorT>())><br>
<br>
I /think/ your version doesn't work for smart pointers, does it?<br>
(judging by <a href="http://en.cppreference.com/w/cpp/types/remove_pointer" target="_blank">http://en.cppreference.com/w/cpp/types/remove_pointer</a> )<br>
and this version should.</blockquote></div><br>Entertainingly, I almost used the version you posted prior to getting std::remove_pointer to work.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I feel strongly that pointee_iterator should work with smart pointers, and I'm somewhat bummed that std::remove_pointer doesn't work.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">How about a slight variation: T = decltype(*std::declval<WrappedIteratorT::value_type>())</div></div>