/* Initializer list support for OctaSTD. * * This file is part of OctaSTD. See COPYING.md for futher information. */ #ifndef OCTA_INITIALIZER_LIST_H #define OCTA_INITIALIZER_LIST_H #include #include "octa/range.h" #ifndef OCTA_ALLOW_CXXSTD /* must be in std namespace otherwise the compiler won't know about it */ namespace std { template class initializer_list { const _T *__buf; size_t __len; initializer_list(const _T *__v, size_t __n): __buf(__v), __len(__n) {} public: initializer_list(): __buf(nullptr), __len(0) {} size_t size() const { return __len; } const _T *begin() const { return __buf; } const _T *end() const { return __buf + __len; } }; } #else #include #endif namespace octa { template using InitializerList = std::initializer_list<_T>; template octa::PointerRange each(std::initializer_list<_T> __init) { return octa::PointerRange(__init.begin(), __init.end()); } } #endif