]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stl_algo.h (is_sorted, [...]): Add.
authorPaolo Carlini <pcarlini@suse.de>
Sun, 14 Oct 2007 21:17:23 +0000 (21:17 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 14 Oct 2007 21:17:23 +0000 (21:17 +0000)
2007-10-14  Paolo Carlini  <pcarlini@suse.de>

* include/bits/stl_algo.h (is_sorted, is_sorted_until): Add.
* include/bits/algorithmfwd.h: Add.
* include/ext/algorithm: Adjust.
* testsuite/25_algorithms/is_sorted/requirements/
explicit_instantiation/2.cc: New.
* testsuite/25_algorithms/is_sorted/requirements/
explicit_instantiation/pod.cc: Likewise.
* testsuite/25_algorithms/is_sorted/1.cc: Likewise.
* testsuite/25_algorithms/is_sorted_until/requirements/
explicit_instantiation/2.cc: Likewise.
* testsuite/25_algorithms/is_sorted_until/requirements/
explicit_instantiation/pod.cc: Likewise.
* testsuite/25_algorithms/is_sorted_until/1.cc: Likewise.
* testsuite/25_algorithms/headers/algorithm/synopsis.cc:
Add is_sorted and is_sorted_until.

* include/bits/stl_heap.h (is_heap_until): Add concept and
debug-mode checks.

From-SVN: r129303

12 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/algorithmfwd.h
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/include/bits/stl_heap.h
libstdc++-v3/include/ext/algorithm
libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc
libstdc++-v3/testsuite/25_algorithms/is_sorted/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/pod.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/is_sorted_until/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/pod.cc [new file with mode: 0644]

index 7b4721b9f9df07de0b01dbbc19fe0504e9477133..3e41f634904b3538d076fa4dea5fe589cdce5c8d 100644 (file)
@@ -1,3 +1,24 @@
+2007-10-14  Paolo Carlini  <pcarlini@suse.de>
+
+       * include/bits/stl_algo.h (is_sorted, is_sorted_until): Add.
+       * include/bits/algorithmfwd.h: Add.
+       * include/ext/algorithm: Adjust.
+       * testsuite/25_algorithms/is_sorted/requirements/
+       explicit_instantiation/2.cc: New.
+       * testsuite/25_algorithms/is_sorted/requirements/
+       explicit_instantiation/pod.cc: Likewise.
+       * testsuite/25_algorithms/is_sorted/1.cc: Likewise.
+       * testsuite/25_algorithms/is_sorted_until/requirements/
+       explicit_instantiation/2.cc: Likewise.
+       * testsuite/25_algorithms/is_sorted_until/requirements/
+       explicit_instantiation/pod.cc: Likewise.
+       * testsuite/25_algorithms/is_sorted_until/1.cc: Likewise.
+       * testsuite/25_algorithms/headers/algorithm/synopsis.cc:
+       Add is_sorted and is_sorted_until.
+
+       * include/bits/stl_heap.h (is_heap_until): Add concept and
+       debug-mode checks.
+
 2007-10-12  Paolo Carlini  <pcarlini@suse.de>
 
        * include/bits/stl_heap.h (__is_heap_until): Add.
index b831e30931b22096dd321e7fd3713570397a446c..9155f83cfbbaa7857101f428f3849e0d68252796 100644 (file)
@@ -197,6 +197,22 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   template<typename _RAIter, typename _Compare>
     _RAIter 
     is_heap_until(_RAIter, _RAIter, _Compare);
+
+  template<typename _FIter>
+    bool 
+    is_sorted(_FIter, _FIter);
+
+  template<typename _FIter, typename _Compare>
+    bool 
+    is_sorted(_FIter, _FIter, _Compare);
+
+  template<typename _FIter>
+    _FIter 
+    is_sorted_until(_FIter, _FIter);
+
+  template<typename _FIter, typename _Compare>
+    _FIter 
+    is_sorted_until(_FIter, _FIter, _Compare);
 #endif
 
   template<typename _FIter1, typename _FIter2>
index 1b1d214964b3c582faf9232b01203ff133543ae1..dd6d7f338c430994f94f39f6dacc1892b7b0b651 100644 (file)
@@ -3409,10 +3409,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /**
    *  @brief  Permute range into the next "dictionary" ordering using
-   *  comparison functor.
+   *          comparison functor.
    *  @param  first  Start of range.
    *  @param  last   End of range.
-   *  @param  comp
+   *  @param  comp   A comparison functor.
    *  @return  False if wrapped to first permutation, true otherwise.
    *
    *  Treats all permutations of the range [first,last) as a set of
@@ -3520,10 +3520,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /**
    *  @brief  Permute range into the previous "dictionary" ordering using
-   *  comparison functor.
+   *          comparison functor.
    *  @param  first  Start of range.
    *  @param  last   End of range.
-   *  @param  comp
+   *  @param  comp   A comparison functor.
    *  @return  False if wrapped to last permutation, true otherwise.
    *
    *  Treats all permutations of the range [first,last) as a set of
@@ -3651,6 +3651,90 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       return __result;
     }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  /**
+   *  @brief  Determines whether the elements of a sequence are sorted.
+   *  @param  first   An iterator.
+   *  @param  last    Another iterator.
+   *  @return  True if the elements are sorted, false otherwise.
+  */
+  template<typename _ForwardIterator>
+    inline bool
+    is_sorted(_ForwardIterator __first, _ForwardIterator __last)
+    { return std::is_sorted_until(__first, __last) == __last; }
+
+  /**
+   *  @brief  Determines whether the elements of a sequence are sorted
+   *          according to a comparison functor.
+   *  @param  first   An iterator.
+   *  @param  last    Another iterator.
+   *  @param  comp    A comparison functor.
+   *  @return  True if the elements are sorted, false otherwise.
+  */
+  template<typename _ForwardIterator, typename _Compare>
+    inline bool
+    is_sorted(_ForwardIterator __first, _ForwardIterator __last,
+             _Compare __comp)
+    { return std::is_sorted_until(__first, __last, __comp) == __last; }
+
+  /**
+   *  @brief  Determines the end of a sorted sequence.
+   *  @param  first   An iterator.
+   *  @param  last    Another iterator.
+   *  @return  An iterator pointing to the last iterator i in [first, last)
+   *           for which the range [first, i) is sorted.
+  */
+  template<typename _ForwardIterator>
+    _ForwardIterator
+    is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
+    {
+      // concept requirements
+      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+      __glibcxx_function_requires(_LessThanComparableConcept<
+           typename iterator_traits<_ForwardIterator>::value_type>)
+      __glibcxx_requires_valid_range(__first, __last);
+
+      if (__first == __last)
+       return __last;
+
+      _ForwardIterator __next = __first;
+      for (++__next; __next != __last; __first = __next, ++__next)
+       if (*__next < *__first)
+         return __next;
+      return __next;
+    }
+
+  /**
+   *  @brief  Determines the end of a sorted sequence using comparison functor.
+   *  @param  first   An iterator.
+   *  @param  last    Another iterator.
+   *  @param  comp    A comparison functor.
+   *  @return  An iterator pointing to the last iterator i in [first, last)
+   *           for which the range [first, i) is sorted.
+  */
+  template<typename _ForwardIterator, typename _Compare>
+    _ForwardIterator
+    is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
+                   _Compare __comp)
+    {
+      // concept requirements
+      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+           typename iterator_traits<_ForwardIterator>::value_type,
+           typename iterator_traits<_ForwardIterator>::value_type>)
+      __glibcxx_requires_valid_range(__first, __last);
+
+      if (__first == __last)
+       return __last;
+
+      _ForwardIterator __next = __first;
+      for (++__next; __next != __last; __first = __next, ++__next)
+       if (__comp(*__next, *__first))
+         return __next;
+      return __next;
+    }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
 _GLIBCXX_END_NAMESPACE
 
 _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
index 06d90937e96843be99d3e972427652747a4ef39f..e800f65c28960a34fd1bf0e8124d737e4c2bd768 100644 (file)
@@ -488,9 +488,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
   /**
-   *  @brief  Check whether a range is a heap.
+   *  @brief  Determines whether a range is a heap.
    *  @param  first  Start of range.
    *  @param  last   End of range.
+   *  @return  True if range is a heap, false otherwise.
    *  @ingroup heap
   */
   template<typename _RandomAccessIterator>
@@ -499,10 +500,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     { return std::is_heap_until(__first, __last) == __last; }
 
   /**
-   *  @brief  Check whether a range is a heap using comparison functor.
+   *  @brief  Determines whether a range is a heap using comparison functor.
    *  @param  first  Start of range.
    *  @param  last   End of range.
    *  @param  comp   Comparison functor to use.
+   *  @return  True if range is a heap, false otherwise.
    *  @ingroup heap
   */
   template<typename _RandomAccessIterator, typename _Compare>
@@ -515,6 +517,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  @brief  Search the end of a heap.
    *  @param  first  Start of range.
    *  @param  last   End of range.
+   *  @return  An iterator pointing to the first element not in the heap.
    *  @ingroup heap
    *
    *  This operation returns the last iterator i in [first, last) for which
@@ -524,6 +527,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     inline _RandomAccessIterator
     is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
     {
+      // concept requirements
+      __glibcxx_function_requires(_RandomAccessIteratorConcept<
+           _RandomAccessIterator>)
+      __glibcxx_function_requires(_LessThanComparableConcept<
+           typename iterator_traits<_RandomAccessIterator>::value_type>)
+      __glibcxx_requires_valid_range(__first, __last);
+
       return __first + std::__is_heap_until(__first, std::distance(__first,
                                                                   __last));
     }
@@ -533,6 +543,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  @param  first  Start of range.
    *  @param  last   End of range.
    *  @param  comp   Comparison functor to use.
+   *  @return  An iterator pointing to the first element not in the heap.
    *  @ingroup heap
    *
    *  This operation returns the last iterator i in [first, last) for which
@@ -543,6 +554,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last,
                  _Compare __comp)
     {
+      // concept requirements
+      __glibcxx_function_requires(_RandomAccessIteratorConcept<
+           _RandomAccessIterator>)
+      __glibcxx_requires_valid_range(__first, __last);
+
       return __first + std::__is_heap_until(__first, std::distance(__first,
                                                                   __last),
                                            __comp);
index 10ca58aa2fd19a1f0edb7b3796dd3cefcda08fb4..5a24b7e6f488162d34f83726df85a61e5f46878a 100644 (file)
@@ -428,6 +428,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
                             __out_last - __out_first);
     }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  using std::is_heap;
+  using std::is_sorted;
+#else
   /**
    *  This is an SGI extension.
    *  @ingroup SGIextensions
@@ -523,6 +527,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
          return false;
       return true;
     }
+#endif
 
 _GLIBCXX_END_NAMESPACE
 
index 3176a53d4e64d5b21f47d8372a65125bd2f68cff..7a02610a3201a63d9434b5c341fc78dc4688ed6b 100644 (file)
@@ -417,6 +417,22 @@ namespace std
   template<typename _RAIter, typename _Compare>
     _RAIter 
     is_heap_until(_RAIter, _RAIter, _Compare);
+
+  template<typename _FIter>
+    bool 
+    is_sorted(_FIter, _FIter);
+
+  template<typename _FIter, typename _Compare>
+    bool 
+    is_sorted(_FIter, _FIter, _Compare);
+
+  template<typename _FIter>
+    _FIter 
+    is_sorted_until(_FIter, _FIter);
+
+  template<typename _FIter, typename _Compare>
+    _FIter 
+    is_sorted_until(_FIter, _FIter, _Compare);
 #endif
 
   // 25.3.7, minimum and maximum:
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted/1.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted/1.cc
new file mode 100644 (file)
index 0000000..840597b
--- /dev/null
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-14  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 25.3.6 Heap operations [lib.alg.heap.operations]
+
+#include <algorithm>
+#include <functional>
+#include <testsuite_hooks.h>
+
+int A[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int B[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+const int N = sizeof(A) / sizeof(int);
+
+void
+test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  for (int i = 0; i <= N; ++i)
+    {
+      VERIFY( std::is_sorted(A, A + i) );
+      VERIFY( std::is_sorted(A, A + i, std::less<int>()) );
+      VERIFY( std::is_sorted(B, B + i, std::greater<int>()) );
+      VERIFY( (i < 2) || !std::is_sorted(B, B + i) );
+    }
+}
+
+int
+main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/2.cc
new file mode 100644 (file)
index 0000000..4005201
--- /dev/null
@@ -0,0 +1,47 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-14  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <algorithm>
+#include <functional>
+#include <testsuite_api.h>
+
+namespace std
+{
+  using __gnu_test::NonDefaultConstructible;
+
+  typedef NonDefaultConstructible              value_type;
+  typedef value_type*          iterator_type;
+  typedef std::less<value_type> compare_type;
+
+  template bool is_sorted(iterator_type, iterator_type);
+  template bool is_sorted(iterator_type, iterator_type, compare_type);
+} 
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/pod.cc
new file mode 100644 (file)
index 0000000..9a2e556
--- /dev/null
@@ -0,0 +1,46 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-14  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <algorithm>
+#include <testsuite_character.h>
+
+namespace std
+{
+  using __gnu_test::pod_int;
+
+  typedef pod_int              value_type;
+  typedef value_type*          iterator_type;
+  typedef std::less<value_type> compare_type;
+
+  template bool is_sorted(iterator_type, iterator_type);
+  template bool is_sorted(iterator_type, iterator_type, compare_type);
+} 
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/1.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/1.cc
new file mode 100644 (file)
index 0000000..7be31ee
--- /dev/null
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-14  Paolo Carlini  <pcarlini@suse.de>
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 25.3.6 Heap operations [lib.alg.heap.operations]
+
+#include <algorithm>
+#include <functional>
+#include <testsuite_hooks.h>
+
+int A[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+int B[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+const int N = sizeof(A) / sizeof(int);
+
+void
+test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  for (int i = 0; i <= N; ++i)
+    {
+      VERIFY( A + i == std::is_sorted_until(A, A + i) );
+      VERIFY( A + i == std::is_sorted_until(A, A + i, std::less<int>()) );
+      VERIFY( B + i == std::is_sorted_until(B, B + i, std::greater<int>()) );
+      VERIFY( B + (i < 2 ? i : 1) == std::is_sorted_until(B, B + i) );      
+    }
+}
+
+int
+main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/2.cc
new file mode 100644 (file)
index 0000000..f13f7b0
--- /dev/null
@@ -0,0 +1,48 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-14  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <algorithm>
+#include <functional>
+#include <testsuite_api.h>
+
+namespace std
+{
+  using __gnu_test::NonDefaultConstructible;
+
+  typedef NonDefaultConstructible              value_type;
+  typedef value_type*          iterator_type;
+  typedef std::less<value_type> compare_type;
+
+  template iterator_type is_sorted_until(iterator_type, iterator_type);
+  template iterator_type is_sorted_until(iterator_type, iterator_type,
+                                        compare_type);
+} 
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/pod.cc
new file mode 100644 (file)
index 0000000..d6a473f
--- /dev/null
@@ -0,0 +1,47 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2007-10-14  Paolo Carlini  <pcarlini@suse.de>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <algorithm>
+#include <testsuite_character.h>
+
+namespace std
+{
+  using __gnu_test::pod_int;
+
+  typedef pod_int              value_type;
+  typedef value_type*          iterator_type;
+  typedef std::less<value_type> compare_type;
+
+  template iterator_type is_sorted_until(iterator_type, iterator_type);
+  template iterator_type is_sorted_until(iterator_type, iterator_type,
+                                        compare_type);
+}