libstdc++
|
![]() |
Functions | |
template<typename _Tp > | |
const _Tp & | std::__median (const _Tp &__a, const _Tp &__b, const _Tp &__c) |
template<typename _Tp , typename _Compare > | |
const _Tp & | std::__median (const _Tp &__a, const _Tp &__b, const _Tp &__c, _Compare __comp) |
Because libstdc++ based its implementation of the STL subsections of the library on the SGI 3.3 implementation, we inherited their extensions as well.
They are additionally documented in the online documentation, a copy of which is also shipped with the library source code (in .../docs/html/documentation.html). You can also read the documentation on SGI's site, which is still running even though the code is not maintained.
NB that the following notes are pulled from various comments all over the place, so they may seem stilted.
|
inline |
Find the median of three values.
a | A value. |
b | A value. |
c | A value. |
a
, b
or c
.If {l
,m,n} is some convolution of {a
,b,c} such that l<=m<=n
then the value returned will be m
. This is an SGI extension.
Definition at line 85 of file stl_algo.h.
Referenced by std::__introsort_loop().
|
inline |
Find the median of three values using a predicate for comparison.
a | A value. |
b | A value. |
c | A value. |
comp | A binary predicate. |
a
, b
or c
.If {l
,m,n} is some convolution of {a
,b,c} such that comp(l,m)
and comp(m,n)
are both true then the value returned will be m
. This is an SGI extension.
Definition at line 119 of file stl_algo.h.