Namespaces
Variants

std::experimental::ranges:: difference_type

From cppreference.net
ヘッダーで定義 <experimental/ranges/iterator>
template < class I >
struct difference_type { } ;
(1)
template < class T >
struct difference_type < T * > ;
(2)
template < class T >
struct difference_type < const T > : difference_type < std:: decay_t < T >> { } ;
(3)
template < class T >

requires requires { typename T :: difference_type ; }

struct difference_type < T > ;
(4)
template < class T >

requires ! requires { typename T :: difference_type ; } &&
requires ( const T & a, const T & b ) { { a - b } - > Integral ; }

struct difference_type < T > ;
(5)

I に関連付けられた差型を計算します(存在する場合)。ユーザーはプログラム定義型に対して difference_type を特殊化できます。

1) プライマリテンプレートは空の構造体です。
2) ポインタに対する特殊化。 T がオブジェクト型の場合、メンバ型 type std::ptrdiff_t として提供する。それ以外の場合、メンバ type は存在しない。
3) const修飾型に対する特殊化。
4) 公開かつアクセス可能なメンバ型 difference_type を定義する型に対する特殊化。 メンバ型 type T::difference_type と等しいものとして提供します。
5) 公開されたアクセス可能なメンバ型 difference_type を定義していないが、減算をサポートする型に対する特殊化。 メンバ型 type std:: make_signed_t < decltype ( std:: declval < T > ( ) - std:: declval < T > ( ) ) > と等しく定義する。

ヘルパーエイリアステンプレート

template < class T >
using difference_type_t = typename ranges :: difference_type < T > :: type ;
(範囲 TS)

関連項目

Semiregular 型が前置および後置インクリメント演算子でインクリメント可能であることを指定する
(コンセプト)
イテレータの関連型を収集する互換性トレイトクラス
(エイリアステンプレート)