operator-(std::basic_const_iterator)


template< std::sized_sentinel_for<Iter> S >
constexpr difference_type operator-( const S& s ) const;
(1) (C++23 起)
template< /*not-a-const-iterator*/ S >

    requires std::sized_sentinel_for<S, Iter>
friend constexpr difference_type

    operator-( const S& s, const basic_const_iterator& i );
(2) (C++23 起)

返回 basic_const_iterator 和其哨位之间的距离。

当且仅当 S 不是 basic_const_iterator 的特化时,S 满足仅用于阐释的概念 /*not-a-const-iterator*/

参数

i, s - 要计算差的迭代器和哨位

返回值

1) base() - s
2) s - i.base()

示例