Skip to content

[libc++][test] Augment test_alloc in deallocate_size.pass.cpp #113638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 @@ -34,15 +34,32 @@ struct test_alloc {
typedef test_alloc<U, Sz> other;
};

TEST_CONSTEXPR_CXX14 pointer allocate(size_type n, const void* = nullptr) {
TEST_CONSTEXPR test_alloc() TEST_NOEXCEPT {}

template <class U>
TEST_CONSTEXPR test_alloc(const test_alloc<U, Sz>&) TEST_NOEXCEPT {}

pointer allocate(size_type n, const void* = nullptr) {
allocated_ += n;
return std::allocator<value_type>().allocate(n);
}

TEST_CONSTEXPR_CXX14 void deallocate(pointer p, size_type s) {
void deallocate(pointer p, size_type s) {
allocated_ -= s;
std::allocator<value_type>().deallocate(p, s);
}

template <class U>
friend TEST_CONSTEXPR bool operator==(const test_alloc&, const test_alloc<U, Sz>&) TEST_NOEXCEPT {
return true;
}

#if TEST_STD_VER < 20
template <class U>
friend TEST_CONSTEXPR bool operator!=(const test_alloc&, const test_alloc<U, Sz>&) TEST_NOEXCEPT {
return false;
}
#endif
};

template <class Sz>
Expand Down
Loading