codekingpro/portable-devtools
114k
1// -*- C++ -*-2//===----------------------- initializer_list -----------------------------===//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//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCUDACXX_INITIALIZER_LIST11#define _LIBCUDACXX_INITIALIZER_LIST12 13/*14 initializer_list synopsis15 16namespace std17{18 19template<class E>20class initializer_list21{22public:23 typedef E value_type;24 typedef const E& reference;25 typedef const E& const_reference;26 typedef size_t size_type;27 28 typedef const E* iterator;29 typedef const E* const_iterator;30 31 initializer_list() noexcept; // constexpr in C++1432 33 size_t size() const noexcept; // constexpr in C++1434 const E* begin() const noexcept; // constexpr in C++1435 const E* end() const noexcept; // constexpr in C++1436};37 38template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++1439template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++1440 41} // std42 43*/44 45#ifndef __cuda_std__46#include <__config>47 48#include "cstddef"49 50#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)51# pragma GCC system_header52#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)53# pragma clang system_header54#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)55# pragma system_header56#endif // no system header57 58namespace std // purposefully not versioned59{60 61template<class _Ep>62class _LIBCUDACXX_TEMPLATE_VIS initializer_list63{64 const _Ep* __begin_;65 size_t __size_;66 67 _LIBCUDACXX_INLINE_VISIBILITY68 _LIBCUDACXX_CONSTEXPR_AFTER_CXX1169 initializer_list(const _Ep* __b, size_t __s) noexcept70 : __begin_(__b),71 __size_(__s)72 {}73public:74 typedef _Ep value_type;75 typedef const _Ep& reference;76 typedef const _Ep& const_reference;77 typedef size_t size_type;78 79 typedef const _Ep* iterator;80 typedef const _Ep* const_iterator;81 82 _LIBCUDACXX_INLINE_VISIBILITY83 _LIBCUDACXX_CONSTEXPR_AFTER_CXX1184 initializer_list() noexcept : __begin_(nullptr), __size_(0) {}85 86 _LIBCUDACXX_INLINE_VISIBILITY87 _LIBCUDACXX_CONSTEXPR_AFTER_CXX1188 size_t size() const noexcept {return __size_;}89 90 _LIBCUDACXX_INLINE_VISIBILITY91 _LIBCUDACXX_CONSTEXPR_AFTER_CXX1192 const _Ep* begin() const noexcept {return __begin_;}93 94 _LIBCUDACXX_INLINE_VISIBILITY95 _LIBCUDACXX_CONSTEXPR_AFTER_CXX1196 const _Ep* end() const noexcept {return __begin_ + __size_;}97};98 99template<class _Ep>100inline _LIBCUDACXX_INLINE_VISIBILITY101_LIBCUDACXX_CONSTEXPR_AFTER_CXX11102const _Ep*103begin(initializer_list<_Ep> __il) noexcept104{105 return __il.begin();106}107 108template<class _Ep>109inline _LIBCUDACXX_INLINE_VISIBILITY110_LIBCUDACXX_CONSTEXPR_AFTER_CXX11111const _Ep*112end(initializer_list<_Ep> __il) noexcept113{114 return __il.end();115}116 117} // std118 119#else120 121#if !defined(_LIBCUDACXX_COMPILER_NVRTC)122#include <initializer_list>123#endif124 125_LIBCUDACXX_BEGIN_NAMESPACE_STD126 using ::std::initializer_list;127_LIBCUDACXX_END_NAMESPACE_STD128 129#endif // __cuda_std__130 131#endif // _LIBCUDACXX_INITIALIZER_LIST132 