From 047079637d8de7f5fa38fc93231265130256d8bb Mon Sep 17 00:00:00 2001 From: paolo Date: Tue, 27 Jul 2010 17:27:06 +0000 Subject: [PATCH] 2010-07-27 Paolo Carlini * 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 --- libstdc++-v3/ChangeLog | 48 ++++++++++ libstdc++-v3/include/Makefile.am | 1 + libstdc++-v3/include/Makefile.in | 1 + libstdc++-v3/include/bits/range_access.h | 102 +++++++++++++++++++++ libstdc++-v3/include/ext/vstring_util.h | 4 +- libstdc++-v3/include/std/array | 1 + libstdc++-v3/include/std/deque | 1 + libstdc++-v3/include/std/forward_list | 1 + libstdc++-v3/include/std/iterator | 1 + libstdc++-v3/include/std/list | 1 + libstdc++-v3/include/std/map | 1 + libstdc++-v3/include/std/regex | 1 + libstdc++-v3/include/std/set | 1 + libstdc++-v3/include/std/string | 1 + libstdc++-v3/include/std/tuple | 18 ++++ libstdc++-v3/include/std/unordered_map | 1 + libstdc++-v3/include/std/unordered_set | 1 + libstdc++-v3/include/std/valarray | 42 +++++++++ libstdc++-v3/include/std/vector | 1 + libstdc++-v3/include/tr1_impl/utility | 20 ++++ libstdc++-v3/libsupc++/initializer_list | 20 ++++ .../18_support/initializer_list/range_access.cc | 30 ++++++ .../testsuite/20_util/pair/range_access.cc | 33 +++++++ .../testsuite/20_util/tuple/range_access.cc | 33 +++++++ .../21_strings/basic_string/range_access.cc | 37 ++++++++ .../testsuite/23_containers/array/range_access.cc | 31 +++++++ .../testsuite/23_containers/deque/range_access.cc | 31 +++++++ .../23_containers/forward_list/range_access.cc | 31 +++++++ .../testsuite/23_containers/list/range_access.cc | 31 +++++++ .../testsuite/23_containers/map/range_access.cc | 31 +++++++ .../23_containers/multimap/range_access.cc | 31 +++++++ .../23_containers/multiset/range_access.cc | 31 +++++++ .../testsuite/23_containers/set/range_access.cc | 31 +++++++ .../23_containers/unordered_map/range_access.cc | 31 +++++++ .../unordered_multimap/range_access.cc | 31 +++++++ .../unordered_multiset/range_access.cc | 31 +++++++ .../23_containers/unordered_set/range_access.cc | 31 +++++++ .../testsuite/23_containers/vector/range_access.cc | 35 +++++++ .../24_iterators/headers/iterator/range_access.cc | 33 +++++++ .../testsuite/24_iterators/range_access.cc | 31 +++++++ .../testsuite/26_numerics/valarray/range_access.cc | 31 +++++++ libstdc++-v3/testsuite/28_regex/range_access.cc | 31 +++++++ libstdc++-v3/testsuite/ext/vstring/range_access.cc | 37 ++++++++ 43 files changed, 970 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/include/bits/range_access.h create mode 100644 libstdc++-v3/testsuite/18_support/initializer_list/range_access.cc create mode 100644 libstdc++-v3/testsuite/20_util/pair/range_access.cc create mode 100644 libstdc++-v3/testsuite/20_util/tuple/range_access.cc create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/array/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/deque/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/list/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/map/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multimap/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multiset/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/range_access.cc create mode 100644 libstdc++-v3/testsuite/23_containers/vector/range_access.cc create mode 100644 libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc create mode 100644 libstdc++-v3/testsuite/24_iterators/range_access.cc create mode 100644 libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc create mode 100644 libstdc++-v3/testsuite/28_regex/range_access.cc create mode 100644 libstdc++-v3/testsuite/ext/vstring/range_access.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ce732b4362e..e435f9f2e39 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,4 +1,52 @@ 2010-07-27 Paolo Carlini + + * 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 Ralf Wildenhues * acinclude.m4 ([GLIBCXX_CHECK_STDIO_MACROS]): Remove. diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 6c0230ad292..6a371a4f8fa 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -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 \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 430f85a252a..1aa641a9c86 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -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 index 00000000000..e9bf67e499b --- /dev/null +++ b/libstdc++-v3/include/bits/range_access.h @@ -0,0 +1,102 @@ +// -*- 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 +// . + +/** @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 + 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 + 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 + 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 + 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 + 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 + inline _Tp* + end(_Tp (&__arr)[_Nm]) + { return __arr + _Nm; } + +_GLIBCXX_END_NAMESPACE + +#endif // __GXX_EXPERIMENTAL_CXX0X__ + +#endif // _GLIBCXX_RANGE_ACCESS_H diff --git a/libstdc++-v3/include/ext/vstring_util.h b/libstdc++-v3/include/ext/vstring_util.h index 4042f70692e..6779f4dc9f0 100644 --- a/libstdc++-v3/include/ext/vstring_util.h +++ b/libstdc++-v3/include/ext/vstring_util.h @@ -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 #include #include +#include _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index d374c88a2b1..26e762de339 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -40,6 +40,7 @@ #endif #include +#include #if defined(_GLIBCXX_INCLUDE_AS_CXX0X) # include diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque index f8a55f72165..b7f4b0acdaf 100644 --- a/libstdc++-v3/include/std/deque +++ b/libstdc++-v3/include/std/deque @@ -63,6 +63,7 @@ #include #include #include +#include #ifndef _GLIBCXX_EXPORT_TEMPLATE # include diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list index 16fdcc283ff..8b11db765b4 100644 --- a/libstdc++-v3/include/std/forward_list +++ b/libstdc++-v3/include/std/forward_list @@ -36,6 +36,7 @@ #else #include +#include #ifndef _GLIBCXX_EXPORT_TEMPLATE # include diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator index 5395106ae6a..90152b7cb28 100644 --- a/libstdc++-v3/include/std/iterator +++ b/libstdc++-v3/include/std/iterator @@ -65,5 +65,6 @@ #include #include #include +#include #endif /* _GLIBCXX_ITERATOR */ diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list index fcf164b4bd5..566bd89ca8e 100644 --- a/libstdc++-v3/include/std/list +++ b/libstdc++-v3/include/std/list @@ -61,6 +61,7 @@ #include #include #include +#include #ifndef _GLIBCXX_EXPORT_TEMPLATE # include diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map index 25f86df6976..0ff8bdd94a2 100644 --- a/libstdc++-v3/include/std/map +++ b/libstdc++-v3/include/std/map @@ -60,6 +60,7 @@ #include #include #include +#include #ifdef _GLIBCXX_DEBUG # include diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index 95ad4239459..eabb843078e 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -52,6 +52,7 @@ #include #include +#include #include #include #include diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set index 0b7805cabec..47d0c971a32 100644 --- a/libstdc++-v3/include/std/set +++ b/libstdc++-v3/include/std/set @@ -60,6 +60,7 @@ #include #include #include +#include #ifdef _GLIBCXX_DEBUG # include diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string index 8c5949fd09c..439557fe169 100644 --- a/libstdc++-v3/include/std/string +++ b/libstdc++-v3/include/std/string @@ -51,6 +51,7 @@ #include #include #include +#include #ifndef _GLIBCXX_EXPORT_TEMPLATE # include diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 8b2252e3686..d2432511f24 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -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 + 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 + 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. */ diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map index 8b664e8fc78..e77a2972af8 100644 --- a/libstdc++-v3/include/std/unordered_map +++ b/libstdc++-v3/include/std/unordered_map @@ -44,6 +44,7 @@ #include #include #include +#include #ifdef _GLIBCXX_DEBUG # include diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set index edbf8f11d8b..739e0a4a449 100644 --- a/libstdc++-v3/include/std/unordered_set +++ b/libstdc++-v3/include/std/unordered_set @@ -44,6 +44,7 @@ #include #include #include +#include #ifdef _GLIBCXX_DEBUG # include diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray index f15ac92b0bf..d67eae26ef7 100644 --- a/libstdc++-v3/include/std/valarray +++ b/libstdc++-v3/include/std/valarray @@ -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 + 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 + 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 + 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 + 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 diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector index 41ecdde6c7b..ca44aaccf66 100644 --- a/libstdc++-v3/include/std/vector +++ b/libstdc++-v3/include/std/vector @@ -64,6 +64,7 @@ #include #include #include +#include #ifndef _GLIBCXX_EXPORT_TEMPLATE # include diff --git a/libstdc++-v3/include/tr1_impl/utility b/libstdc++-v3/include/tr1_impl/utility index a31c4da8794..c3b3527f963 100644 --- a/libstdc++-v3/include/tr1_impl/utility +++ b/libstdc++-v3/include/tr1_impl/utility @@ -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 + 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 + inline _InputIterator + end(const std::pair<_InputIterator, _InputIterator>& __p) + { return __p.second; } +#endif + _GLIBCXX_END_NAMESPACE_TR1 } diff --git a/libstdc++-v3/libsupc++/initializer_list b/libstdc++-v3/libsupc++/initializer_list index f4a8f864259..0006b70f40a 100644 --- a/libstdc++-v3/libsupc++/initializer_list +++ b/libstdc++-v3/libsupc++/initializer_list @@ -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 + 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 + 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 index 00000000000..f4bf96bb3ef --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/initializer_list/range_access.cc @@ -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 +// . + +// 18.9.3 Initializer list range access [support.initlist.range] + +#include + +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 index 00000000000..036b78cc419 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pair/range_access.cc @@ -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 +// . + +// 20.3.5.4, pair range access: [pair.range] + +#include +#include + +void +test01() +{ + std::vector 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 index 00000000000..dad7523ef7f --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/range_access.cc @@ -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 +// . + +// 20.4.2.10, tuple range access: pair range access [tuple.range] + +#include +#include + +void +test01() +{ + std::vector 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 index 00000000000..1ce386cbe96 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +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 index 00000000000..544d9f91ce1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/array/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::array 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 index 00000000000..d996ed6d1b0 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::deque 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 index 00000000000..378cd9f0b1e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::forward_list 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 index 00000000000..afe148d9e66 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::list 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 index 00000000000..2fb7f4ac943 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::map 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 index 00000000000..da4c77b4aca --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::multimap 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 index 00000000000..b8e3accce6c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::multiset 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 index 00000000000..ffbda4e93fe --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::set 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 index 00000000000..b41b6a5b3ee --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::unordered_map 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 index 00000000000..f95a6681b1b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::unordered_multimap 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 index 00000000000..137b0d6d2e9 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::unordered_multiset 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 index 00000000000..ea116c364af --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::unordered_set 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 index 00000000000..0a10959b240 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +void +test01() +{ + std::vector v{1.0, 2.0, 3.0}; + std::begin(v); + std::end(v); + + std::vector 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 index 00000000000..8082e0d0631 --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access.cc @@ -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 +// . + +#include + +namespace std +{ + template auto begin(C& c) -> decltype(c.begin()); + template auto begin(const C& c) -> decltype(c.begin()); + + template auto end(C& c) -> decltype(c.end()); + template auto end(const C& c) -> decltype(c.end()); + + template T* begin(T (&array)[N]); + template 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 index 00000000000..3bd1d2e5da3 --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +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 index 00000000000..be08d0298d3 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/range_access.cc @@ -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 +// . + +// 26.6.10 valarray range access: [valarray.range] + +#include + +void +test01() +{ + std::valarray 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 index 00000000000..0bd620f0bd5 --- /dev/null +++ b/libstdc++-v3/testsuite/28_regex/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +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 index 00000000000..32322924709 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/range_access.cc @@ -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 +// . + +// 24.6.5, range access [iterator.range] + +#include + +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 +} -- 2.11.4.GIT