Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors include/memory/allocator_traits.h to fix MSVC warning N5014 by replacing the previously‑exposed memory::allocator_traits<Alloc> helper (which users were expected to inject as a specialization of std::allocator_traits) with a new CRTP-style memory::allocator_adapter<Allocator, T, BackendAllocator> base class. Custom allocators now inherit from allocator_adapter and let the primary std::allocator_traits template detect the inherited nested types and members, avoiding the previously fragile/forbidden specialization of standard-library templates. The test allocator in wal_object_test.cpp is migrated to this new pattern.
Changes:
- Removed the SFINAE-heavy
memory::allocator_traits<Alloc>helper plus all detection macros, and introducedallocator_adapter(withis_always_equal/backend-equal helpers andoperator==/operator!=). - Updated the example/header documentation to describe the new adapter-based usage and explicitly warn against specializing
std::allocator_traits. - Migrated
test_wal_object_test_allocatorin the WAL test to inherit fromallocator_adapterand removed the previousstd::allocator_traitsspecialization block.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
include/memory/allocator_traits.h |
Replaces the old traits helper with a CRTP allocator_adapter and updates header docs/pragmas. |
test/case/wal_object_test.cpp |
Updates the test allocator to use allocator_adapter and drops the std::allocator_traits specialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.