std::equal_to, not_equal_to, less, greater, less_equal, greater_equal(std::experimental::propagate_const)
來自 cppreference.com
< cpp | experimental | propagate const
定義於標頭檔案 <experimental/propagate_const> |
||
template< class T > struct equal_to<std::experimental::propagate_const<T>>; |
(庫基礎 TS v2) | |
template< class T > struct not_equal_to<std::experimental::propagate_const<T>>; |
(庫基礎 TS v2) | |
template< class T > struct less<std::experimental::propagate_const<T>>; |
(庫基礎 TS v2) | |
template< class T > struct greater<std::experimental::propagate_const<T>>; |
(庫基礎 TS v2) | |
template< class T > struct less_equal<std::experimental::propagate_const<T>>; |
(庫基礎 TS v2) | |
template< class T > struct greater_equal<std::experimental::propagate_const<T>>; |
(庫基礎 TS v2) | |
標準比較函式物件針對 std::experimental::propagate_const<T> 進行了部分特化。
令 p.t_ 表示由 std::experimental::propagate_const<T> p 包裝的類指標物件,那麼給定型別為 std::experimental::propagate_const<T> 的物件 p
和 q
,應滿足以下條件:
- std::equal_to<std::experimental::propagate_const<T>>()(p, q) == std::equal_to<T>()(p.t_, q.t_)
- std::not_equal_to<std::experimental::propagate_const<T>>()(p, q) == std::not_equal_to<T>()(p.t_, q.t_)
- std::less<std::experimental::propagate_const<T>>()(p, q) == std::less<T>()(p.t_, q.t_)
- std::greater<std::experimental::propagate_const<T>>()(p, q) == std::greater<T>()(p.t_, q.t_)
- std::less_equal<std::experimental::propagate_const<T>>()(p, q) == std::less_equal<T>()(p.t_, q.t_)
- std::greater_equal<std::experimental::propagate_const<T>>()(p, q) == std::greater_equal<T>()(p.t_, q.t_)
[編輯] 注意
這些特化確保當 T
是指標型別時,這些類模板對 std::experimental::propagate_const<T> 的特化會產生一個全序關係,即使相應的內建運算子不產生全序關係。
[編輯] 示例
本節不完整 原因:無示例 |
[編輯] 參閱
實現 x == y 的函式物件 (類模板) | |
實現 x != y 的函式物件 (類模板) | |
實現 x < y 的函式物件 (類模板) | |
實現 x > y 的函式物件 (類模板) | |
實現 x <= y 的函式物件 (類模板) | |
實現 x >= y 的函式物件 (類模板) |