Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#ifndef TEST_STD_CONTAINERS_VIEWS_MDSPAN_MINIMAL_ELEMENT_TYPE_H
#define TEST_STD_CONTAINERS_VIEWS_MDSPAN_MINIMAL_ELEMENT_TYPE_H

#include<memory>
#include <memory>
#include <type_traits>

// Idiosyncratic element type for mdspan
// Make sure we don't assume copyable, default constructible, movable etc.
Expand All @@ -25,7 +26,7 @@ struct MinimalElementType {
template<class T, size_t N>
struct ElementPool {
constexpr ElementPool() {
ptr_ = std::allocator<T>().allocate(N);
ptr_ = std::allocator<std::remove_const_t<T>>().allocate(N);
for (int i = 0; i != N; ++i)
std::construct_at(ptr_ + i, 42);
}
Expand All @@ -35,11 +36,11 @@ struct ElementPool {
constexpr ~ElementPool() {
for (int i = 0; i != N; ++i)
std::destroy_at(ptr_ + i);
std::allocator<T>().deallocate(ptr_, N);
std::allocator<std::remove_const_t<T>>().deallocate(ptr_, N);
}

private:
T* ptr_;
std::remove_const_t<T>* ptr_;
};

#endif // TEST_STD_CONTAINERS_VIEWS_MDSPAN_MINIMAL_ELEMENT_TYPE_H