2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef LIBCPP_TEST_STD_UTILITIES_MEMORY_SPECIALIZED_ALGORITHMS_BUFFER_H
11 #define LIBCPP_TEST_STD_UTILITIES_MEMORY_SPECIALIZED_ALGORITHMS_BUFFER_H
13 template <typename T
, int N
>
15 alignas(T
) char buffer
[sizeof(T
) * N
] = {};
17 T
* begin() { return reinterpret_cast<T
*>(buffer
); }
18 T
* end() { return begin() + N
; }
19 const T
* cbegin() const { return reinterpret_cast<const T
*>(buffer
); }
20 const T
* cend() const { return cbegin() + N
; }
22 constexpr int size() const { return N
; }
25 #endif // LIBCPP_TEST_STD_UTILITIES_MEMORY_SPECIALIZED_ALGORITHMS_BUFFER_H