Skip to content

Commit bd89485

Browse files
committed
Fix initializer_list definition
Closes #462
1 parent fa9a271 commit bd89485

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/libcxx/include/initializer_list

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,28 @@ namespace std {
1111

1212
template<class _Ep>
1313
class initializer_list {
14-
const _Ep __begin;
15-
size_t __size;
14+
public:
15+
using value_type = _Ep;
16+
using reference = _Ep&;
17+
using const_reference = _Ep const&;
18+
using size_type = size_t;
19+
using iterator = const _Ep*;
20+
using const_iterator = const _Ep*;
21+
22+
private:
23+
iterator __begin;
24+
size_type __size;
1625

17-
_EZCXX_INLINE initializer_list(const _Ep* __begin, size_t __size) noexcept : __begin(__begin), __size(__size) {}
26+
_EZCXX_INLINE constexpr initializer_list(const_iterator __begin, size_type __size) noexcept : __begin(__begin), __size(__size) {}
1827

1928
public:
20-
_EZCXX_INLINE initializer_list() noexcept : initializer_list(nullptr, 0) {}
29+
_EZCXX_INLINE constexpr initializer_list() noexcept : initializer_list(nullptr, 0) {}
2130

22-
_EZCXX_INLINE size_t size() const noexcept { return __size; }
31+
_EZCXX_INLINE constexpr size_type size() const noexcept { return __size; }
2332

24-
_EZCXX_INLINE const _Ep* begin() const noexcept { return __begin; }
33+
_EZCXX_INLINE constexpr const_iterator begin() const noexcept { return __begin; }
2534

26-
_EZCXX_INLINE const _Ep* end() const noexcept { return __begin + __size; }
35+
_EZCXX_INLINE constexpr const_iterator end() const noexcept { return __begin + __size; }
2736
};
2837

2938
template<class _Ep>

0 commit comments

Comments
 (0)