From 81d75f1b5679dd94d912675a7951402714cc1169 Mon Sep 17 00:00:00 2001 From: Chris Glover Date: Thu, 18 Feb 2016 22:54:10 -0500 Subject: [PATCH] Add a check for begin == end to allow users to supply an empty list to lockfree::stack::push --- include/boost/lockfree/stack.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/boost/lockfree/stack.hpp b/include/boost/lockfree/stack.hpp index 6db986c..455a772 100644 --- a/include/boost/lockfree/stack.hpp +++ b/include/boost/lockfree/stack.hpp @@ -243,6 +243,11 @@ class stack template tuple prepare_node_list(ConstIterator begin, ConstIterator end, ConstIterator & ret) { + if (begin == end) { + ret = begin; + return make_tuple(NULL, NULL); + } + ConstIterator it = begin; node * end_node = pool.template construct(*it++); if (end_node == NULL) {