OSDN Git Service

2010-07-27 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Jul 2010 17:27:06 +0000 (17:27 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Jul 2010 17:27:06 +0000 (17:27 +0000)
* include/ext/vstring_util.h: Include bits/range_access.h.
* testsuite/ext/vstring/range_access.cc: New test.

2010-07-27  Ed Smith-Rowland  <3dw4rd@verizon.net>

* include/bits/range_access.h: New.
* include/Makefile.in: Add bits/range_access.h.
* include/Makefile.am: Regenerate.
* include/std/array: Include bits/range_access.h.
* include/std/deque: Ditto.
* include/std/forward_list: Ditto.
* include/std/iterator: Ditto.
* include/std/list: Ditto.
* include/std/map: Ditto.
* include/std/regex: Ditto.
* include/std/set: Ditto.
* include/std/string: Ditto.
* include/std/unordered_map: Ditto.
* include/std/unordered_set: Ditto.
* include/std/vector: Ditto.
* include/std/valarray: Add begin() and end().
* libsupc++/initializer_list: Ditto.
* include/tr1_impl/utility: Add begin() and end().
* include/std/tuple: Ditto.
* testsuite/24_iterators/headers/iterator/range_access.cc: New test.
* testsuite/24_iterators/range_access.cc: Ditto.
* testsuite/28_regex/range_access.cc: Ditto.
* testsuite/18_support/initializer_list/range_access.cc: Ditto.
* testsuite/21_strings/basic_string/range_access.cc: Ditto.
* testsuite/26_numerics/valarray/range_access.cc: Ditto.
* testsuite/23_containers/unordered_map/range_access.cc: Ditto.
* testsuite/23_containers/multimap/range_access.cc: Ditto.
* testsuite/23_containers/set/range_access.cc: Ditto.
* testsuite/23_containers/unordered_multimap/range_access.cc: Ditto.
* testsuite/23_containers/forward_list/range_access.cc: Ditto.
* testsuite/23_containers/unordered_set/range_access.cc: Ditto.
* testsuite/23_containers/vector/range_access.cc: Ditto.
* testsuite/23_containers/deque/range_access.cc: Ditto.
* testsuite/23_containers/multiset/range_access.cc: Ditto.
* testsuite/23_containers/list/range_access.cc: Ditto.
* testsuite/23_containers/unordered_multiset/range_access.cc: Ditto.
* testsuite/23_containers/map/range_access.cc: Ditto.
* testsuite/23_containers/array/range_access.cc: Ditto.
* testsuite/20_util/tuple/range_access.cc: Ditto.
* testsuite/20_util/pair/range_access.cc: Ditto.

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

43 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/range_access.h [new file with mode: 0644]
libstdc++-v3/include/ext/vstring_util.h
libstdc++-v3/include/std/array
libstdc++-v3/include/std/deque
libstdc++-v3/include/std/forward_list
libstdc++-v3/include/std/iterator
libstdc++-v3/include/std/list
libstdc++-v3/include/std/map
libstdc++-v3/include/std/regex
libstdc++-v3/include/std/set
libstdc++-v3/include/std/string
libstdc++-v3/include/std/tuple
libstdc++-v3/include/std/unordered_map
libstdc++-v3/include/std/unordered_set
libstdc++-v3/include/std/valarray
libstdc++-v3/include/std/vector
libstdc++-v3/include/tr1_impl/utility
libstdc++-v3/libsupc++/initializer_list
libstdc++-v3/testsuite/18_support/initializer_list/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/pair/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/tuple/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/array/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/deque/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/forward_list/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/list/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/map/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multimap/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multiset/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/set/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_multiset/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_set/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/vector/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/24_iterators/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/28_regex/range_access.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/vstring/range_access.cc [new file with mode: 0644]

index ce732b4..e435f9f 100644 (file)
@@ -1,4 +1,52 @@
 2010-07-27  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/ext/vstring_util.h: Include bits/range_access.h.
+       * testsuite/ext/vstring/range_access.cc: New test.
+
+2010-07-27  Ed Smith-Rowland  <3dw4rd@verizon.net>
+
+       * include/bits/range_access.h: New.
+       * include/Makefile.in: Add bits/range_access.h.
+       * include/Makefile.am: Regenerate.
+       * include/std/array: Include bits/range_access.h.
+       * include/std/deque: Ditto.
+       * include/std/forward_list: Ditto.
+       * include/std/iterator: Ditto.
+       * include/std/list: Ditto.
+       * include/std/map: Ditto.
+       * include/std/regex: Ditto.
+       * include/std/set: Ditto.
+       * include/std/string: Ditto.
+       * include/std/unordered_map: Ditto.
+       * include/std/unordered_set: Ditto.
+       * include/std/vector: Ditto.
+       * include/std/valarray: Add begin() and end().
+       * libsupc++/initializer_list: Ditto.
+       * include/tr1_impl/utility: Add begin() and end().
+       * include/std/tuple: Ditto.
+       * testsuite/24_iterators/headers/iterator/range_access.cc: New test.
+       * testsuite/24_iterators/range_access.cc: Ditto.
+       * testsuite/28_regex/range_access.cc: Ditto.
+       * testsuite/18_support/initializer_list/range_access.cc: Ditto.
+       * testsuite/21_strings/basic_string/range_access.cc: Ditto.
+       * testsuite/26_numerics/valarray/range_access.cc: Ditto.
+       * testsuite/23_containers/unordered_map/range_access.cc: Ditto.
+       * testsuite/23_containers/multimap/range_access.cc: Ditto.
+       * testsuite/23_containers/set/range_access.cc: Ditto.
+       * testsuite/23_containers/unordered_multimap/range_access.cc: Ditto.
+       * testsuite/23_containers/forward_list/range_access.cc: Ditto.
+       * testsuite/23_containers/unordered_set/range_access.cc: Ditto.
+       * testsuite/23_containers/vector/range_access.cc: Ditto.
+       * testsuite/23_containers/deque/range_access.cc: Ditto.
+       * testsuite/23_containers/multiset/range_access.cc: Ditto.
+       * testsuite/23_containers/list/range_access.cc: Ditto.
+       * testsuite/23_containers/unordered_multiset/range_access.cc: Ditto.
+       * testsuite/23_containers/map/range_access.cc: Ditto.
+       * testsuite/23_containers/array/range_access.cc: Ditto.
+       * testsuite/20_util/tuple/range_access.cc: Ditto.
+       * testsuite/20_util/pair/range_access.cc: Ditto.
+
+2010-07-27  Paolo Carlini  <paolo.carlini@oracle.com>
            Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * acinclude.m4 ([GLIBCXX_CHECK_STDIO_MACROS]): Remove.
index 6c0230a..6a371a4 100644 (file)
@@ -121,6 +121,7 @@ bits_headers = \
        ${bits_srcdir}/postypes.h \
        ${bits_srcdir}/random.h \
        ${bits_srcdir}/random.tcc \
+       ${bits_srcdir}/range_access.h \
        ${bits_srcdir}/regex.h \
        ${bits_srcdir}/regex_compiler.h \
        ${bits_srcdir}/regex_constants.h \
index 430f85a..1aa641a 100644 (file)
@@ -363,6 +363,7 @@ bits_headers = \
        ${bits_srcdir}/postypes.h \
        ${bits_srcdir}/random.h \
        ${bits_srcdir}/random.tcc \
+       ${bits_srcdir}/range_access.h \
        ${bits_srcdir}/regex.h \
        ${bits_srcdir}/regex_compiler.h \
        ${bits_srcdir}/regex_constants.h \
diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h
new file mode 100644 (file)
index 0000000..e9bf67e
--- /dev/null
@@ -0,0 +1,102 @@
+// <range_access.h> -*- C++ -*-
+
+// Copyright (C) 2010 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/range_access.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_RANGE_ACCESS_H
+#define _GLIBCXX_RANGE_ACCESS_H 1
+
+#pragma GCC system_header
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the container.
+   *  @param  cont  Container.
+   */
+  template<class _Container>
+    inline auto
+    begin(_Container& __cont) -> decltype(__cont.begin())
+    { return __cont.begin(); }
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the const container.
+   *  @param  cont  Container.
+   */
+  template<class _Container>
+    inline auto
+    begin(const _Container& __cont) -> decltype(__cont.begin())
+    { return __cont.begin(); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *          the container.
+   *  @param  cont  Container.
+   */
+  template<class _Container>
+    inline auto
+    end(_Container& __cont) -> decltype(__cont.end())
+    { return __cont.end(); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *          the const container.
+   *  @param  cont  Container.
+   */
+  template<class _Container>
+    inline auto
+    end(const _Container& __cont) -> decltype(__cont.end())
+    { return __cont.end(); }
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of the array.
+   *  @param  arr  Array.
+   */
+  template<class _Tp, size_t _Nm>
+    inline _Tp*
+    begin(_Tp (&__arr)[_Nm])
+    { return __arr; }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element
+   *          of the array.
+   *  @param  arr  Array.
+   */
+  template<class _Tp, size_t _Nm>
+    inline _Tp*
+    end(_Tp (&__arr)[_Nm])
+    { return __arr + _Nm; }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
+#endif // _GLIBCXX_RANGE_ACCESS_H
index 4042f70..6779f4d 100644 (file)
@@ -1,6 +1,7 @@
 // Versatile string utility -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+// 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
@@ -42,6 +43,7 @@
 #include <bits/stl_iterator.h>
 #include <ext/numeric_traits.h>
 #include <bits/move.h>
+#include <bits/range_access.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
index d374c88..26e762d 100644 (file)
@@ -40,6 +40,7 @@
 #endif
 
 #include <bits/stl_algobase.h>
+#include <bits/range_access.h>
 
 #if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
 #  include <tr1_impl/array>
index f8a55f7..b7f4b0a 100644 (file)
@@ -63,6 +63,7 @@
 #include <bits/stl_construct.h>
 #include <bits/stl_uninitialized.h>
 #include <bits/stl_deque.h>
+#include <bits/range_access.h>
 
 #ifndef _GLIBCXX_EXPORT_TEMPLATE
 # include <bits/deque.tcc>
index 16fdcc2..8b11db7 100644 (file)
@@ -36,6 +36,7 @@
 #else
 
 #include <bits/forward_list.h>
+#include <bits/range_access.h>
 
 #ifndef _GLIBCXX_EXPORT_TEMPLATE
 # include <bits/forward_list.tcc>
index 5395106..90152b7 100644 (file)
@@ -65,5 +65,6 @@
 #include <istream>
 #include <bits/stream_iterator.h>
 #include <bits/streambuf_iterator.h>
+#include <bits/range_access.h>
 
 #endif /* _GLIBCXX_ITERATOR */
index fcf164b..566bd89 100644 (file)
@@ -61,6 +61,7 @@
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
 #include <bits/stl_list.h>
+#include <bits/range_access.h>
 
 #ifndef _GLIBCXX_EXPORT_TEMPLATE
 # include <bits/list.tcc>
index 25f86df..0ff8bdd 100644 (file)
@@ -60,6 +60,7 @@
 #include <bits/stl_tree.h>
 #include <bits/stl_map.h>
 #include <bits/stl_multimap.h>
+#include <bits/range_access.h>
 
 #ifdef _GLIBCXX_DEBUG
 # include <debug/map>
index 95ad423..eabb843 100644 (file)
@@ -52,6 +52,7 @@
 #include <utility>
 #include <vector>
 
+#include <bits/range_access.h>
 #include <bits/regex_constants.h>
 #include <bits/regex_error.h>
 #include <bits/regex_cursor.h>
index 0b7805c..47d0c97 100644 (file)
@@ -60,6 +60,7 @@
 #include <bits/stl_tree.h>
 #include <bits/stl_set.h>
 #include <bits/stl_multiset.h>
+#include <bits/range_access.h>
 
 #ifdef _GLIBCXX_DEBUG
 # include <debug/set>
index 8c5949f..439557f 100644 (file)
@@ -51,6 +51,7 @@
 #include <ext/numeric_traits.h> 
 #include <bits/stl_algobase.h> 
 #include <bits/basic_string.h>
+#include <bits/range_access.h>
 
 #ifndef _GLIBCXX_EXPORT_TEMPLATE
 # include <bits/basic_string.tcc> 
index 8b2252e..d243251 100644 (file)
@@ -697,6 +697,24 @@ namespace std
   const _Swallow_assign ignore{};
 
   /**
+   *  @brief  Return the first of a tuple containing two input iterators.
+   *  @param  tpl  Tuple.
+   */
+  template<class _InputIterator>
+    inline _InputIterator
+    begin(const tuple<_InputIterator, _InputIterator>& __tpl)
+    { return get<0>(__tpl); }
+
+  /**
+   *  @brief  Return the second of a tuple containing two input iterators.
+   *  @param  tpl  Tuple.
+   */
+  template<class _InputIterator>
+    inline _InputIterator
+    end(const tuple<_InputIterator, _InputIterator>& __tpl)
+    { return get<1>(__tpl); }
+
+  /**
    * Stores a tuple of indices. Used by bind() to extract the elements
    * in a tuple. 
    */
index 8b664e8..e77a297 100644 (file)
@@ -44,6 +44,7 @@
 #include <bits/functional_hash.h>
 #include <bits/hashtable.h>
 #include <bits/unordered_map.h>
+#include <bits/range_access.h>
 
 #ifdef _GLIBCXX_DEBUG
 # include <debug/unordered_map>
index edbf8f1..739e0a4 100644 (file)
@@ -44,6 +44,7 @@
 #include <bits/functional_hash.h>
 #include <bits/hashtable.h>
 #include <bits/unordered_set.h>
+#include <bits/range_access.h>
 
 #ifdef _GLIBCXX_DEBUG
 # include <debug/unordered_set>
index f15ac92..d67eae2 100644 (file)
@@ -1107,6 +1107,48 @@ _DEFINE_BINARY_OPERATOR(>=, __greater_equal)
 
 #undef _DEFINE_BINARY_OPERATOR
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the valarray.
+   *  @param  va  valarray.
+   */
+  template<class _Tp>
+    inline _Tp*
+    begin(valarray<_Tp>& __va)
+    { return std::__addressof(__va[0]); }
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the const valarray.
+   *  @param  va  valarray.
+   */
+  template<class _Tp>
+    inline const _Tp*
+    begin(const valarray<_Tp>& __va)
+    { return std::__addressof(__va[0]); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *          the valarray.
+   *  @param  va  valarray.
+   */
+  template<class _Tp>
+    inline _Tp*
+    end(valarray<_Tp>& __va)
+    { return std::__addressof(__va[0]) + __va.size(); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element of
+   *          the const valarray.
+   *  @param  va  valarray.
+   */
+  template<class _Tp>
+    inline const _Tp*
+    end(const valarray<_Tp>& __va)
+    { return std::__addressof(__va[0]) + __va.size(); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
   // @} group numeric_arrays
 
 _GLIBCXX_END_NAMESPACE
index 41ecdde..ca44aac 100644 (file)
@@ -64,6 +64,7 @@
 #include <bits/stl_uninitialized.h>
 #include <bits/stl_vector.h>
 #include <bits/stl_bvector.h> 
+#include <bits/range_access.h>
 
 #ifndef _GLIBCXX_EXPORT_TEMPLATE
 # include <bits/vector.tcc>
index a31c4da..c3b3527 100644 (file)
@@ -115,6 +115,26 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
     get(const std::pair<_Tp1, _Tp2>& __in)
     { return __pair_get<_Int>::__const_get(__in); }
 
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+  /**
+   *  @brief  Return the first of a pair containing two input iterators.
+   *  @param  p  Pair.
+   */
+  template<class _InputIterator>
+    inline _InputIterator
+    begin(const std::pair<_InputIterator, _InputIterator>& __p)
+    { return __p.first; }
+
+  /**
+   *  @brief  Return the second of a pair containing two input iterators.
+   *  @param  p  Pair.
+   */
+  template<class _InputIterator>
+    inline _InputIterator
+    end(const std::pair<_InputIterator, _InputIterator>& __p)
+    { return __p.second; }
+#endif
+
 _GLIBCXX_END_NAMESPACE_TR1
 }
 
index f4a8f86..0006b70 100644 (file)
@@ -75,6 +75,26 @@ namespace std
       const_iterator
       end() const { return begin() + size(); }
   };
+
+  /**
+   *  @brief  Return an iterator pointing to the first element of
+   *          the initilizer_list.
+   *  @param  il  Initializer list.
+   */
+  template<class _Tp>
+    inline const _Tp*
+    begin(initializer_list<_Tp> __ils)
+    { return __ils.begin(); }
+
+  /**
+   *  @brief  Return an iterator pointing to one past the last element
+   *          of the initilizer_list.
+   *  @param  il  Initializer list.
+   */
+  template<class _Tp>
+    inline const _Tp*
+    end(initializer_list<_Tp> __ils)
+    { return __ils.end(); }
 }
 
 #pragma GCC visibility pop
diff --git a/libstdc++-v3/testsuite/18_support/initializer_list/range_access.cc b/libstdc++-v3/testsuite/18_support/initializer_list/range_access.cc
new file mode 100644 (file)
index 0000000..f4bf96b
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 18.9.3 Initializer list range access [support.initlist.range]
+
+#include <initializer_list>
+
+void
+test01()
+{
+  std::begin({1, 2, 3});
+  std::end({1, 2, 3});
+}
diff --git a/libstdc++-v3/testsuite/20_util/pair/range_access.cc b/libstdc++-v3/testsuite/20_util/pair/range_access.cc
new file mode 100644 (file)
index 0000000..036b78c
--- /dev/null
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 20.3.5.4, pair range access: [pair.range]
+
+#include <utility>
+#include <vector>
+
+void
+test01()
+{
+  std::vector<double> v{1.0, 2.0, 3.0};
+  auto p = std::make_pair(v.begin(), v.end());
+  std::begin(p);
+  std::end(p);
+}
diff --git a/libstdc++-v3/testsuite/20_util/tuple/range_access.cc b/libstdc++-v3/testsuite/20_util/tuple/range_access.cc
new file mode 100644 (file)
index 0000000..dad7523
--- /dev/null
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 20.4.2.10, tuple range access: pair range access [tuple.range]
+
+#include <tuple>
+#include <vector>
+
+void
+test01()
+{
+  std::vector<double> v{1.0, 2.0, 3.0};
+  auto t = std::make_tuple(v.begin(), v.end());
+  std::begin(t);
+  std::end(t);
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/range_access.cc b/libstdc++-v3/testsuite/21_strings/basic_string/range_access.cc
new file mode 100644 (file)
index 0000000..1ce386c
--- /dev/null
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <string>
+
+void
+test01()
+{
+  std::string s("Hello, World!");
+  std::begin(s);
+  std::end(s);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  std::wstring ws(L"Hello, World!");
+  std::begin(ws);
+  std::end(ws);
+#endif
+}
diff --git a/libstdc++-v3/testsuite/23_containers/array/range_access.cc b/libstdc++-v3/testsuite/23_containers/array/range_access.cc
new file mode 100644 (file)
index 0000000..544d9f9
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <array>
+
+void
+test01()
+{
+  std::array<int, 3> a{1, 2, 3};
+  std::begin(a);
+  std::end(a);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/range_access.cc b/libstdc++-v3/testsuite/23_containers/deque/range_access.cc
new file mode 100644 (file)
index 0000000..d996ed6
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <deque>
+
+void
+test01()
+{
+  std::deque<int> d{1, 2, 3};
+  std::begin(d);
+  std::end(d);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/range_access.cc b/libstdc++-v3/testsuite/23_containers/forward_list/range_access.cc
new file mode 100644 (file)
index 0000000..378cd9f
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <forward_list>
+
+void
+test01()
+{
+  std::forward_list<int> fl{1, 2, 3};
+  std::begin(fl);
+  std::end(fl);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/range_access.cc b/libstdc++-v3/testsuite/23_containers/list/range_access.cc
new file mode 100644 (file)
index 0000000..afe148d
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <list>
+
+void
+test01()
+{
+  std::list<int> l{1, 2, 3};
+  std::begin(l);
+  std::end(l);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/range_access.cc b/libstdc++-v3/testsuite/23_containers/map/range_access.cc
new file mode 100644 (file)
index 0000000..2fb7f4a
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <map>
+
+void
+test01()
+{
+  std::map<int, double> m{{1, 1.0}, {2, 2.0}, {3, 3.0}};
+  std::begin(m);
+  std::end(m);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/range_access.cc b/libstdc++-v3/testsuite/23_containers/multimap/range_access.cc
new file mode 100644 (file)
index 0000000..da4c77b
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <map>
+
+void
+test01()
+{
+  std::multimap<int, double> mm{{1, 1.0}, {2, 2.0}, {3, 3.0}};
+  std::begin(mm);
+  std::end(mm);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/range_access.cc b/libstdc++-v3/testsuite/23_containers/multiset/range_access.cc
new file mode 100644 (file)
index 0000000..b8e3acc
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <set>
+
+void
+test01()
+{
+  std::multiset<int> ms{1, 2, 3};
+  std::begin(ms);
+  std::end(ms);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/range_access.cc b/libstdc++-v3/testsuite/23_containers/set/range_access.cc
new file mode 100644 (file)
index 0000000..ffbda4e
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <set>
+
+void
+test01()
+{
+  std::set<int> s{1, 2, 3};
+  std::begin(s);
+  std::end(s);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc
new file mode 100644 (file)
index 0000000..b41b6a5
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <unordered_map>
+
+void
+test01()
+{
+  std::unordered_map<int, double> um{{1, 1.0}, {2, 2.0}, {3, 3.0}};
+  std::begin(um);
+  std::end(um);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc
new file mode 100644 (file)
index 0000000..f95a668
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <unordered_map>
+
+void
+test01()
+{
+  std::unordered_multimap<int, double> umm{{1, 1.0}, {2, 2.0}, {3, 3.0}};
+  std::begin(umm);
+  std::end(umm);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/range_access.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/range_access.cc
new file mode 100644 (file)
index 0000000..137b0d6
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <unordered_set>
+
+void
+test01()
+{
+  std::unordered_multiset<int> ums{1, 2, 3};
+  std::begin(ums);
+  std::end(ums);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/range_access.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/range_access.cc
new file mode 100644 (file)
index 0000000..ea116c3
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <unordered_set>
+
+void
+test01()
+{
+  std::unordered_set<int> us{1, 2, 3};
+  std::begin(us);
+  std::end(us);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/range_access.cc b/libstdc++-v3/testsuite/23_containers/vector/range_access.cc
new file mode 100644 (file)
index 0000000..0a10959
--- /dev/null
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <vector>
+
+void
+test01()
+{
+  std::vector<double> v{1.0, 2.0, 3.0};
+  std::begin(v);
+  std::end(v);
+
+  std::vector<bool> vb{true, false, true};
+  std::begin(vb);
+  std::end(vb);
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc
new file mode 100644 (file)
index 0000000..8082e0d
--- /dev/null
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <iterator>
+
+namespace std
+{
+  template<class C> auto begin(C& c) -> decltype(c.begin());
+  template<class C> auto begin(const C& c) -> decltype(c.begin());
+
+  template<class C> auto end(C& c) -> decltype(c.end());
+  template<class C> auto end(const C& c) -> decltype(c.end());
+
+  template<class T, size_t N> T* begin(T (&array)[N]);
+  template<class T, size_t N> T* end(T (&array)[N]);
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/range_access.cc b/libstdc++-v3/testsuite/24_iterators/range_access.cc
new file mode 100644 (file)
index 0000000..3bd1d2e
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <iterator>
+
+void
+test01()
+{
+  int arr[3] = {1, 2, 3};
+  std::begin(arr);
+  std::end(arr);
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc b/libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc
new file mode 100644 (file)
index 0000000..be08d02
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.6.10 valarray range access: [valarray.range]
+
+#include <valarray>
+
+void
+test01()
+{
+  std::valarray<double> va{1.0, 2.0, 3.0};
+  std::begin(va);
+  std::end(va);
+}
diff --git a/libstdc++-v3/testsuite/28_regex/range_access.cc b/libstdc++-v3/testsuite/28_regex/range_access.cc
new file mode 100644 (file)
index 0000000..0bd620f
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <regex>
+
+void
+test01()
+{
+  std::smatch sm;
+  std::begin(sm);
+  std::end(sm);
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/range_access.cc b/libstdc++-v3/testsuite/ext/vstring/range_access.cc
new file mode 100644 (file)
index 0000000..3232292
--- /dev/null
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <ext/vstring.h>
+
+void
+test01()
+{
+  __gnu_cxx::__vstring s("Hello, World!");
+  std::begin(s);
+  std::end(s);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  __gnu_cxx::__wvstring ws(L"Hello, World!");
+  std::begin(ws);
+  std::end(ws);
+#endif
+}