From 1b4c588009899ae58ef03035b692c7cce65b45a4 Mon Sep 17 00:00:00 2001 From: FritzFlorian Date: Tue, 14 May 2019 10:39:29 +0200 Subject: [PATCH] Add further type-safety check to work_stealing_deque. --- lib/pls/include/pls/internal/data_structures/work_stealing_deque.h | 2 +- lib/pls/include/pls/internal/data_structures/work_stealing_deque_impl.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/pls/include/pls/internal/data_structures/work_stealing_deque.h b/lib/pls/include/pls/internal/data_structures/work_stealing_deque.h index 3bddd82..5c8ce86 100644 --- a/lib/pls/include/pls/internal/data_structures/work_stealing_deque.h +++ b/lib/pls/include/pls/internal/data_structures/work_stealing_deque.h @@ -85,7 +85,7 @@ class work_stealing_deque { std::pair *allocate_item(const T &new_item); template - Item *push_tail(const T &new_item); + T *push_tail(const T &new_item); Item *pop_tail(); Item *pop_head(); diff --git a/lib/pls/include/pls/internal/data_structures/work_stealing_deque_impl.h b/lib/pls/include/pls/internal/data_structures/work_stealing_deque_impl.h index ea860a2..95987a5 100644 --- a/lib/pls/include/pls/internal/data_structures/work_stealing_deque_impl.h +++ b/lib/pls/include/pls/internal/data_structures/work_stealing_deque_impl.h @@ -38,7 +38,10 @@ std::pair *work_stealing_deque::allocate_item template template -Item *work_stealing_deque::push_tail(const T &new_item) { +T *work_stealing_deque::push_tail(const T &new_item) { + static_assert(std::is_same::value || std::is_base_of::value, + "Must only push types of onto work_stealing_deque"); + offset_t local_tail = tail_; auto new_pair = allocate_item(new_item); -- libgit2 0.26.0