codekingpro/portable-devtools
114k
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-exception7// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.8//9//===----------------------------------------------------------------------===//10 11#ifndef _LIBCUDACXX___ITERATOR_ACCESS_H12#define _LIBCUDACXX___ITERATOR_ACCESS_H13 14#ifndef __cuda_std__15#include <__config>16#endif //__cuda_std__17 18#include "../cstddef"19 20#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)21# pragma GCC system_header22#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)23# pragma clang system_header24#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)25# pragma system_header26#endif // no system header27 28_LIBCUDACXX_BEGIN_NAMESPACE_STD29 30template <class _Tp, size_t _Np>31_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX1132_Tp*33begin(_Tp (&__array)[_Np])34{35 return __array;36}37 38template <class _Tp, size_t _Np>39_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX1140_Tp*41end(_Tp (&__array)[_Np])42{43 return __array + _Np;44}45 46template <class _Cp>47_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX1448auto49begin(_Cp& __c) -> decltype(__c.begin())50{51 return __c.begin();52}53 54template <class _Cp>55_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX1456auto57begin(const _Cp& __c) -> decltype(__c.begin())58{59 return __c.begin();60}61 62template <class _Cp>63_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX1464auto65end(_Cp& __c) -> decltype(__c.end())66{67 return __c.end();68}69 70template <class _Cp>71_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX1472auto73end(const _Cp& __c) -> decltype(__c.end())74{75 return __c.end();76}77 78#if _LIBCUDACXX_STD_VER > 1179 80template <class _Cp>81_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX1182auto cbegin(const _Cp& __c) -> decltype(_CUDA_VSTD::begin(__c))83{84 return _CUDA_VSTD::begin(__c);85}86 87template <class _Cp>88_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX1189auto cend(const _Cp& __c) -> decltype(_CUDA_VSTD::end(__c))90{91 return _CUDA_VSTD::end(__c);92}93 94#endif95 96_LIBCUDACXX_END_NAMESPACE_STD97 98#endif // _LIBCUDACXX___ITERATOR_ACCESS_H99 