Skip to content

Commit 2195ffb

Browse files
committed
static_assert(is_empty_v<Alloc>)
1 parent d0adb12 commit 2195ffb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/daking/MPSC_queue.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,12 @@ namespace daking {
411411
using alloc_page_t = typename manager_t::alloc_page_t;
412412
using altraits_page_t = typename manager_t::altraits_page_t;
413413

414+
static_assert(std::is_empty_v<allocator_type>,
415+
"In the global manager design, Alloc must be stateless to avoid dangling references. "
416+
);
417+
414418
static_assert(
415-
std::is_constructible_v<alloc_node_t, allocator_type> && // for constructor of MPSC_manager
416-
std::is_constructible_v<alloc_page_t, allocator_type>,
419+
std::is_constructible_v<alloc_node_t, allocator_type> && std::is_constructible_v<alloc_page_t, allocator_type>,
417420
"Alloc should have a template constructor like 'Alloc(const Alloc<T>& alloc)' to meet internal conversion."
418421
);
419422

0 commit comments

Comments
 (0)