/
redgpu
/
ispc
Обзор
Документация
Войти
/
redgpu
/
ispc
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
builtins/array.hpp
47 строк
1 KB
Dmitry Babokin
Remove the phrase "All rights reserved."
01 апр 2023, 03:48
01 апр 2023, 03:48
33bd2b4
Код
Авторство
О чём код?
/* Copyright (c) 2020-2023, Intel Corporation SPDX-License-Identifier: BSD-3-Clause */ /** @file array.hpp @brief minimal implementation of std::array This header is added to avoid additional dependency on C++ library for builtins-c-cpu.cpp file. */ namespace notstd { template <typename T, int sizeImpl> struct array { T dataImpl[sizeImpl]; using value_type = T; using reference = T &; using const_reference = const T &; using pointer = T *; using const_pointer = const T *; using iterator = pointer; using const_iterator = const_pointer; using size_type = int; size_type size() const noexcept { return sizeImpl; } pointer data() noexcept { return &dataImpl[0]; } const_pointer data() const noexcept { return &dataImpl[0]; } iterator begin() noexcept { return data(); } const_iterator begin() const noexcept { return data(); } iterator end() noexcept { return data() + size(); } const_iterator end() const noexcept { return data() + size(); } const_reference operator[](int idx) const noexcept { return dataImpl[idx]; } reference operator[](int idx) noexcept { return dataImpl[idx]; } }; } // namespace notstd