f67a9881a8
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
103 lines
3.0 KiB
C++
103 lines
3.0 KiB
C++
// <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
|