std::logical_not
來自 cppreference.com
定義於標頭檔案 <functional> |
||
template< class T > struct logical_not; |
(直到 C++14) | |
template< class T = void > struct logical_not; |
(C++14 起) | |
用於執行邏輯非(邏輯否定)的函式物件。實際呼叫型別 T
的 operator!。
目錄 |
[編輯] 特化
當未指定
|
(C++14 起) |
[編輯] 成員型別
型別 | 定義 |
result_type (C++17 中已棄用)(C++20 中已移除) |
bool |
argument_type (C++17 中已棄用)(C++20 中已移除) |
T
|
這些成員型別透過公有繼承 std::unary_function<T, bool> 獲得。 |
(C++11 前) |
[編輯] 成員函式
operator() |
返回引數的邏輯非 (公開成員函式) |
std::logical_not::operator()
bool operator()( const T& arg ) const; |
(C++14 起為 constexpr) | |
返回 arg 的邏輯非。
引數
arg | - | 要計算邏輯非的值 |
返回值
!arg 的結果。
[編輯] 異常
可能丟擲實現定義的異常。
可能的實現
constexpr // since C++14 bool operator()(const T& arg) const { return !arg; } |