2010-02-15 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Feb 2010 16:55:20 +0000 (16:55 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Feb 2010 16:55:20 +0000 (16:55 +0000)
* include/bits/stl_algo.h (__median): Move...
* include/ext/algorithm: ... here, being an SGI extension.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156776 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/include/ext/algorithm

index 8dace9d..3334c13 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/bits/stl_algo.h (__median): Move...
+       * include/ext/algorithm: ... here, being an SGI extension.
+
 2010-02-12  Jonathan Wakely  <jwakely.gcc@gmail.com>
            Paolo Carlini  <paolo.carlini@oracle.com>
 
index ed72656..6da898b 100644 (file)
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
-  /**
-   *  @brief Find the median of three values.
-   *  @param  a  A value.
-   *  @param  b  A value.
-   *  @param  c  A value.
-   *  @return One of @p a, @p b or @p c.
-   *
-   *  If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n
-   *  then the value returned will be @c m.
-   *  This is an SGI extension.
-   *  @ingroup SGIextensions
-  */
-  template<typename _Tp>
-    inline const _Tp&
-    __median(const _Tp& __a, const _Tp& __b, const _Tp& __c)
-    {
-      // concept requirements
-      __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
-      if (__a < __b)
-       if (__b < __c)
-         return __b;
-       else if (__a < __c)
-         return __c;
-       else
-         return __a;
-      else if (__a < __c)
-       return __a;
-      else if (__b < __c)
-       return __c;
-      else
-       return __b;
-    }
-
-  /**
-   *  @brief Find the median of three values using a predicate for comparison.
-   *  @param  a     A value.
-   *  @param  b     A value.
-   *  @param  c     A value.
-   *  @param  comp  A binary predicate.
-   *  @return One of @p a, @p b or @p c.
-   *
-   *  If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m)
-   *  and @p comp(m,n) are both true then the value returned will be @c m.
-   *  This is an SGI extension.
-   *  @ingroup SGIextensions
-  */
-  template<typename _Tp, typename _Compare>
-    inline const _Tp&
-    __median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp)
-    {
-      // concept requirements
-      __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
-                                                        _Tp, _Tp>)
-      if (__comp(__a, __b))
-       if (__comp(__b, __c))
-         return __b;
-       else if (__comp(__a, __c))
-         return __c;
-       else
-         return __a;
-      else if (__comp(__a, __c))
-       return __a;
-      else if (__comp(__b, __c))
-       return __c;
-      else
-       return __b;
-    }
-
   /// Swaps the median value of *__a, *__b and *__c to *__a
   template<typename _Iterator>
     void
index 9b2108b..5956e24 100644 (file)
@@ -520,6 +520,74 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
       return true;
     }
 
+  /**
+   *  @brief Find the median of three values.
+   *  @param  a  A value.
+   *  @param  b  A value.
+   *  @param  c  A value.
+   *  @return One of @p a, @p b or @p c.
+   *
+   *  If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n
+   *  then the value returned will be @c m.
+   *  This is an SGI extension.
+   *  @ingroup SGIextensions
+  */
+  template<typename _Tp>
+    const _Tp&
+    __median(const _Tp& __a, const _Tp& __b, const _Tp& __c)
+    {
+      // concept requirements
+      __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
+      if (__a < __b)
+       if (__b < __c)
+         return __b;
+       else if (__a < __c)
+         return __c;
+       else
+         return __a;
+      else if (__a < __c)
+       return __a;
+      else if (__b < __c)
+       return __c;
+      else
+       return __b;
+    }
+
+  /**
+   *  @brief Find the median of three values using a predicate for comparison.
+   *  @param  a     A value.
+   *  @param  b     A value.
+   *  @param  c     A value.
+   *  @param  comp  A binary predicate.
+   *  @return One of @p a, @p b or @p c.
+   *
+   *  If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m)
+   *  and @p comp(m,n) are both true then the value returned will be @c m.
+   *  This is an SGI extension.
+   *  @ingroup SGIextensions
+  */
+  template<typename _Tp, typename _Compare>
+    const _Tp&
+    __median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp)
+    {
+      // concept requirements
+      __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
+                                                        _Tp, _Tp>)
+      if (__comp(__a, __b))
+       if (__comp(__b, __c))
+         return __b;
+       else if (__comp(__a, __c))
+         return __c;
+       else
+         return __a;
+      else if (__comp(__a, __c))
+       return __a;
+      else if (__comp(__b, __c))
+       return __c;
+      else
+       return __b;
+    }
+
 _GLIBCXX_END_NAMESPACE
 
 #endif /* _EXT_ALGORITHM */