1

我希望熟悉 boost iterator_facade 实现的人能够阐明为什么在选择writable_postfix_increment_proxy或时使用以下元函数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*
    >
{};

这可以在此处找到,并在元函数postfix_increment_result中使用,该函数选择后缀运算符是否应返回代理或仅返回迭代器。其余的postfix_increment_result似乎很清楚。就像是..

如果 iter::reference 是可读的并且类别基本上等同于 input_iterator_tag 或 output_iterator_tag 则返回一个代理。

但是我很困惑is_non_proxy_reference,这似乎true与忽略 cv 限定符Reference相同。Value在这种情况下使用postfix_increment_proxy<Iterator>else writable_postfix_increment_proxy<Iterator>

什么Reference时候会成为不同的“基本类型” Value?如果您愿意,这是否支持返回您自己的代理类型?或者是其他东西?

4

0 回答 0