From 892009458b717c523b6a3a85b9021f0073c70ea8 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 21 Sep 2017 14:03:22 +0100 Subject: [PATCH] Changed pop_into container a template. --- src/queue.h | 6 ++++-- src/stack.h | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/queue.h b/src/queue.h index ebafd8af..7e9b35fe 100644 --- a/src/queue.h +++ b/src/queue.h @@ -397,10 +397,12 @@ namespace etl //************************************************************************* /// Gets the oldest value and removes it from the front of the queue and - /// pushes it to the destination queue. + /// pushes it to the destination container. /// If asserts or exceptions are enabled, throws an etl::queue_empty if the queue is empty. + /// NOTE: The destination must support a push(T) member function. //************************************************************************* - void pop_into(iqueue& destination) + template + void pop_into(TContainer& destination) { destination.push(front()); pop(); diff --git a/src/stack.h b/src/stack.h index 85a5c888..d41e38b3 100644 --- a/src/stack.h +++ b/src/stack.h @@ -362,10 +362,11 @@ namespace etl //************************************************************************* /// Removes the oldest item from the top of the stack and pushes it to the - /// top of the destination stack. - /// NOTE: This reverses the stack order. + /// destination container. + /// NOTE: The destination must support a push(T) member function. //************************************************************************* - void pop_into(istack& destination) + template + void pop_into(TContainer& destination) { destination.push(top()); pop();