Boost iterator_facade implementation

81 Views Asked by At

I am hoping someone familiar with the boost iterator_facade implementation can shed some light on why the following meta function is used when selecting either writable_postfix_increment_proxy or postfix_increment_proxy.

template <class Reference, class Value>
struct is_non_proxy_reference
  : is_convertible<
        typename remove_reference<Reference>::type
        const volatile*
      , Value const volatile*
    >
{};

This can be found here and is used in the metafunction postfix_increment_result that selects whether the postfix operator should return either a proxy or the just the iterator. The rest of the postfix_increment_result seems pretty clear. Something like..

if iter::reference is readable and the category is basically the equivalent of input_iterator_tag or output_iterator_tag then a proxy is returned.

However I am confused about is_non_proxy_reference, which appears to be true in the case that Reference is the same as Value ignoring cv qualifiers. In which case postfix_increment_proxy<Iterator> else writable_postfix_increment_proxy<Iterator> in used.

When is Reference going to be a different 'base type' to Value? Is this to support returning your own proxy type if you wanted? Or something else?

0

There are 0 best solutions below