not1 (STL/CLR)
會產生unary_negate的 functor。
template<typename Fun>
unary_negate<Fun> not1(Fun% functor);
Template Parameters
- 娛樂特區
Functor 型別。
函式參數
- functor
若要自動換行 functor。
備註
The template function returns unary_negate (STL/CLR)<Fun>(functor). 您可以使用它作為方便的方式來傳遞其邏輯 NOT functor 中換行引數 functor。
範例
// cliext_not1.cpp
// compile with: /clr
#include <cliext/algorithm>
#include <cliext/functional>
#include <cliext/vector>
typedef cliext::vector<int> Myvector;
int main()
{
Myvector c1;
c1.push_back(4);
c1.push_back(0);
Myvector c3(2, 0);
// display initial contents " 4 0"
for each (int elem in c1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// transform and display
cliext::logical_not<int> not_op;
cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
cliext::unary_negate<cliext::logical_not<int> >(not_op));
for each (int elem in c3)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// transform and display with function
cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
cliext::not1(not_op));
for each (int elem in c3)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
需求
標頭: < cliext/功能 >
Namespace: cliext