min man page on SunOS

Man page or keyword search:  
man Server   20652 pages
apropos Keyword Search (all sections)
Output format
SunOS logo
[printable version]

min(3C++)			       -			     min(3C++)

Standard C++ Library Copyright 1998, Rogue Wave Software, Inc.

NAME
       min

	- Finds and returns the minimum of a pair of values.

SYNOPSIS
       #include <algorithm>
       template <class T>
       const T& min(const T&, const T&);

       template <class T, class Compare>
       const T& min(const T& a, const T&, Compare);

DESCRIPTION
       The  min algorithm determines and returns the minimum of a pair of val‐
       ues. In the second version of the algorithm, the optional argument Com‐
       pare  defines  a	 comparison  function that can be used in place of the
       default operator<.

       min returns the first argument when the two arguments are equal.

EXAMPLE
       //
       // max.cpp
       //
 #include <algorithm>
 #include <iostream>
using namespace std;

int main(void)
 {
  double d1 = 10.0, d2 = 20.0;

   // Find minimum
  double val1 = min(d1, d2);
   // val1 = 10.0

   // the greater comparator returns the greater of the
   // two values.
  double val2 = min(d1, d2, greater<double>());
   // val2 = 20.0;

   // Find maximum
  double val3 = max(d1, d2);
   // val3 = 20.0;

   // the less comparator returns the smaller of the
   // two values.
   // Note that, like every comparison in the STL, max is
   // defined in terms of the < operator, so using less here
   // is the same as using the max algorithm with a default
   // comparator.
  double val4 = max(d1, d2, less<double>());
   // val4 = 20

  cout << val1 << " " << val2 << " "
	<< val3 << " " << val4 << endl;

  return 0;
 }

Program Output

10 20 20 20

SEE ALSO
       max, max_element, min_element

Rogue Wave Software		  02 Apr 1998			     min(3C++)
[top]

List of man pages available for SunOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net