divides


A binary function object that returns the result of dividing its two operands.

Library

Standards<ToolKit>

Declaration


#include <functional>

template< class T >
struct divides : binary_function< T, T, T >

Interface

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

int input[ 3 ] = { 2, 3, 4 };

void
main()
  {
  int result = accumulate( input, input + 3, 48, divides< int >() );

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

result = 2

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