From ab6049d0277d0f8577aa963ce536ac8b34164d06 Mon Sep 17 00:00:00 2001 From: kotofyt Date: Fri, 9 Jan 2026 20:50:14 +0200 Subject: [PATCH] no more dependency on intitializer_list header --- public/tier1/utlinitlist.h | 49 +++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/public/tier1/utlinitlist.h b/public/tier1/utlinitlist.h index b4dfcff..eb08468 100644 --- a/public/tier1/utlinitlist.h +++ b/public/tier1/utlinitlist.h @@ -9,7 +9,54 @@ #ifndef TIER1_UTL_INITIALIZER_LIST_H #define TIER1_UTL_INITIALIZER_LIST_H -#include "initializer_list" +#include "stddef.h" + +// from GCC +namespace std +{ + template + class initializer_list + { + public: + typedef _E value_type; + typedef const _E& reference; + typedef const _E& const_reference; + typedef size_t size_type; + typedef const _E* iterator; + typedef const _E* const_iterator; + + private: + iterator _M_array; + size_type _M_len; + + constexpr initializer_list(const_iterator __a, size_type __l) + : _M_array(__a), _M_len(__l) { } + + public: + constexpr initializer_list() noexcept + : _M_array(0), _M_len(0) { } + + constexpr size_type + size() const noexcept { return _M_len; } + + constexpr const_iterator + begin() const noexcept { return _M_array; } + + constexpr const_iterator + end() const noexcept { return begin() + size(); } + }; + + template + constexpr const _Tp* + begin(initializer_list<_Tp> __ils) noexcept + { return __ils.begin(); } + + template + constexpr const _Tp* + end(initializer_list<_Tp> __ils) noexcept + { return __ils.end(); } +} + template using CUtlInitializerList = std::initializer_list;