diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2010-07-27 17:27:06 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2010-07-27 17:27:06 +0000 |
commit | f67a9881a86bcdeb67fa52c0a8eb45ce9d4134d4 (patch) | |
tree | fe5f2e2bd09e714c8ed3e945800795e79446e5c6 /libstdc++-v3/testsuite | |
parent | 9f39bd531612c767cbcf0148b3baa95a9122453e (diff) | |
download | gcc-f67a9881a86bcdeb67fa52c0a8eb45ce9d4134d4.zip gcc-f67a9881a86bcdeb67fa52c0a8eb45ce9d4134d4.tar.gz gcc-f67a9881a86bcdeb67fa52c0a8eb45ce9d4134d4.tar.bz2 |
[multiple changes]
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.
From-SVN: r162578
Diffstat (limited to 'libstdc++-v3/testsuite')
22 files changed, 703 insertions, 0 deletions
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 0000000..f4bf96b --- /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 +// <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 index 0000000..036b78c --- /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 +// <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 index 0000000..dad7523 --- /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 +// <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 index 0000000..1ce386c --- /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 +// <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 index 0000000..544d9f9 --- /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 +// <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 index 0000000..d996ed6 --- /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 +// <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 index 0000000..378cd9f --- /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 +// <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 index 0000000..afe148d --- /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 +// <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 index 0000000..2fb7f4a --- /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 +// <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 index 0000000..da4c77b --- /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 +// <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 index 0000000..b8e3acc --- /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 +// <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 index 0000000..ffbda4e --- /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 +// <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 index 0000000..b41b6a5 --- /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 +// <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 index 0000000..f95a668 --- /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 +// <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 index 0000000..137b0d6 --- /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 +// <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 index 0000000..ea116c3 --- /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 +// <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 index 0000000..0a10959b --- /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 +// <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 index 0000000..8082e0d --- /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 +// <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 index 0000000..3bd1d2e --- /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 +// <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 index 0000000..be08d02 --- /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 +// <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 index 0000000..0bd620f --- /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 +// <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 index 0000000..3232292 --- /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 +// <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 +} |