]>
git.saurik.com Git - apple/xnu.git/blob - tests/bounded_array_src/operator.subscript.cpp
3 // T& operator[](ptrdiff_t n);
4 // T const& operator[](ptrdiff_t n) const;
7 #include <libkern/c++/bounded_array.h>
8 #include "test_policy.h"
9 #include <darwintest.h>
10 #include <type_traits>
14 operator==(T
const& a
, T
const& b
)
24 test_bounded_array
<T
, 5> array
= {T
{0}, T
{1}, T
{2}, T
{3}, T
{4}};
26 CHECK(&a0
== array
.data());
39 test_bounded_array
<T
, 5> const array
= {T
{0}, T
{1}, T
{2}, T
{3}, T
{4}};
40 T
const& a0
= array
[0];
41 CHECK(&a0
== array
.data());
43 T
const& a1
= array
[1];
45 T
const& a2
= array
[2];
47 T
const& a3
= array
[3];
49 T
const& a4
= array
[4];
54 T_DECL(operator_subscript
, "bounded_array.operator.subscript") {