logical_not


A unary function object that returns true if its operand is zero ( false ).

Library

Standards<ToolKit>

Declaration


#include <functional>

template< class T >
struct logical_not : unary_function< T, bool >

Interface

()
bool operator()( const T& x ) const
Returns ! x .
Example <ospace/osstd/examples/logicnot.cpp>
#include <iostream>
#include <algorithm>
#include <functional>

bool input[ 7 ] = { 1, 0, 0, 1, 1, 1, 1 };

void
main()
  {
  int n = 0;

  count_if( input, input + 7, logical_not< bool >(), n );

  cout << "count = " << n << "\n";
  }

count = 2

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.