median.hpp
Go to the documentation of this file.
00001 /* 00002 Copyright 2005-2008 Adobe Systems Incorporated 00003 Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 00004 or a copy at http://stlab.adobe.com/licenses.html) 00005 */ 00006 /**************************************************************************************************/ 00007 00008 #ifndef ADOBE_ALGORITHM_MEDIAN_HPP 00009 #define ADOBE_ALGORITHM_MEDIAN_HPP 00010 00011 #include <adobe/algorithm/select.hpp> 00012 #include <adobe/functional.hpp> 00013 00014 namespace adobe { 00015 00016 /**************************************************************************************************/ 00032 /**************************************************************************************************/ 00033 00038 template <typename T, typename R> 00039 inline const T& median(const T& a, const T& b, const T& c, R r) 00040 { return select_1(a, b, c, r); } 00041 00046 template <typename T, typename R> 00047 inline T& median(T& a, T& b, T& c, R r) 00048 { return select_1(a, b, c, r); } 00049 00054 template <typename T> 00055 inline const T& median(const T& a, const T& b, const T& c) 00056 { return select_1(a, b, c, adobe::less()); } 00057 00062 template <typename T> 00063 inline T& median(T& a, T& b, T& c) 00064 { return select_1(a, b, c, adobe::less()); } 00065 00066 /**************************************************************************************************/ 00067 00068 } // namespace adobe 00069 #endif |