Adobe Source Libraries
2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
median.hpp
Go to the documentation of this file.
1
/*
2
Copyright 2013 Adobe
3
Distributed under the Boost Software License, Version 1.0.
4
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
*/
6
/**************************************************************************************************/
7
8
#ifndef ADOBE_ALGORITHM_MEDIAN_HPP
9
#define ADOBE_ALGORITHM_MEDIAN_HPP
10
11
#include <
adobe/algorithm/select.hpp
>
12
#include <
adobe/functional.hpp
>
13
14
#include <functional>
15
16
namespace
adobe
{
17
18
/**************************************************************************************************/
33
34
/**************************************************************************************************/
35
40
template
<
typename
T,
typename
R>
41
inline
const
T&
median
(
const
T& a,
const
T& b,
const
T& c, R r) {
42
return
select_1_3
(a, b, c, std::bind(r, std::placeholders::_1, std::placeholders::_2));
43
}
44
49
template
<
typename
T,
typename
R>
50
inline
T&
median
(T& a, T& b, T& c, R r) {
51
return
select_1_3
(a, b, c, std::bind(r, std::placeholders::_1, std::placeholders::_2));
52
}
53
58
template
<
typename
T>
59
inline
const
T&
median
(
const
T& a,
const
T& b,
const
T& c) {
60
return
select_1_3
(a, b, c,
less
());
61
}
62
67
template
<
typename
T>
68
inline
T&
median
(T& a, T& b, T& c) {
69
return
select_1_3
(a, b, c,
less
());
70
}
71
72
/**************************************************************************************************/
73
74
}
// namespace adobe
75
#endif
select.hpp
functional.hpp
adobe::median
const T & median(const T &a, const T &b, const T &c, R r)
median implementation
Definition
median.hpp:41
adobe::select_1_3
const T & select_1_3(const T &a, const T &b, const T &c, R r)
select_1 implementation
Definition
algorithm/select.hpp:126
adobe
Definition
class_template.hpp:7
adobe::less
Definition
operator.hpp:52
adobe
algorithm
median.hpp
Generated by
1.14.0