1 // -*- C++ -*- 2 //===----------------------------------------------------------------------===// 3 // 4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef _LIBCPP___CXX03___ITERATOR_ACCESS_H 11 #define _LIBCPP___CXX03___ITERATOR_ACCESS_H 12 13 #include <__cxx03/__config> 14 #include <__cxx03/cstddef> 15 16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 17 # pragma GCC system_header 18 #endif 19 20 _LIBCPP_BEGIN_NAMESPACE_STD 21 22 template <class _Tp, size_t _Np> begin(_Tp (& __array)[_Np])23_LIBCPP_HIDE_FROM_ABI _Tp* begin(_Tp (&__array)[_Np]) _NOEXCEPT { 24 return __array; 25 } 26 27 template <class _Tp, size_t _Np> end(_Tp (& __array)[_Np])28_LIBCPP_HIDE_FROM_ABI _Tp* end(_Tp (&__array)[_Np]) _NOEXCEPT { 29 return __array + _Np; 30 } 31 32 template <class _Cp> begin(_Cp & __c)33_LIBCPP_HIDE_FROM_ABI typename _Cp::iterator begin(_Cp& __c) { 34 return __c.begin(); 35 } 36 37 template <class _Cp> begin(const _Cp & __c)38_LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator begin(const _Cp& __c) { 39 return __c.begin(); 40 } 41 42 template <class _Cp> end(_Cp & __c)43_LIBCPP_HIDE_FROM_ABI typename _Cp::iterator end(_Cp& __c) { 44 return __c.end(); 45 } 46 47 template <class _Cp> end(const _Cp & __c)48_LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator end(const _Cp& __c) { 49 return __c.end(); 50 } 51 52 _LIBCPP_END_NAMESPACE_STD 53 54 #endif // _LIBCPP___CXX03___ITERATOR_ACCESS_H 55