logical_not (STL/CLR)

模板类描述,那么,当调用,则返回 true 的一 functor,仅当任一参数测试如错误。您使用它来指定函数对象基于其参数类型。

template<typename Arg>
    ref class logical_not
    { // wrap operator()
public:
    typedef Arg argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::UnaryDelegate<
        argument_type, result_type>
        delegate_type;

    logical_not();
    logical_not(logical_not<Arg> %right);

    result_type operator()(argument_type left);
    operator delegate_type^();
    };

参数

  • Arg
    参数的类型。

成员函数

类型定义

说明

argument_type

functor 参数的类型。

delegate_type

泛型委托的类型。

result_type

functor 结果的类型。

成员

说明

logical_not

构造 functor。

运算符

说明

运算符 ()

计算所需的功能。

运算符 delegate_type^

转换 functor 为委托。

备注

模板类描述一个参数 functor。它定义成员运算符 operator() ,这样,对象时,调用函数时,它将返回 true,仅在其参数测试如错误。

还可以通过对象,因为类型是 delegate_type^ ,它将相应地转换函数参数。

示例

// cliext_logical_not.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::transform(c1.begin(), c1.begin() + 2, 
        c3.begin(), cliext::logical_not<int>()); 
    for each (int elem in c3) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
  

要求

标题: <cliext/函数>

命名空间: cliext

请参见

参考

negate (STL/CLR)