minus |
A binary function object that returns the result of subtracting its second operand from its first operand.
- y .
#include <iostream>
#include <algorithm>
#include <functional>
int input1[ 4 ] = { 1, 5, 7, 8 };
int input2[ 4 ] = { 1, 4, 8, 3 };
void
main()
{
int output[ 4 ];
transform( input1, input1 + 4, input2, output, minus< int >() );
for ( int i = 0; i < 4; ++i )
cout << output[ i ] << "\n";
}
0
1
-1
5
Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.