logical_and


A binary function object that returns true if both of its operands are true .

Library

Standards<ToolKit>

Declaration


#include <functional>

template< class T >
struct logical_and : binary_function< T, T, bool >

Interface

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

bool input1[ 4 ] = { 1, 1, 0, 1 };
bool input2[ 4 ] = { 0, 1, 0, 0 };

void
main()
  {
  int output[ 4 ];

  transform( input1, input1 + 4, input2, output, logical_and< bool >() );

  for ( int i = 0; i < 4; ++i )
    cout << output[ i ] << "\n";
  }

0
1
0
0

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