Changed pop_into container a template.

This commit is contained in:
John Wellbelove 2017-09-21 14:03:22 +01:00
parent c6e1e9ac00
commit 892009458b
2 changed files with 8 additions and 5 deletions

View File

@ -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 <typename TContainer>
void pop_into(TContainer& destination)
{
destination.push(front());
pop();

View File

@ -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 <typename TContainer>
void pop_into(TContainer& destination)
{
destination.push(top());
pop();