remove unecessary code from stack and readd printing to Treiber stack

This commit is contained in:
2021-01-10 22:00:38 +01:00
parent 37a2584ffc
commit 66759e77e8
4 changed files with 14 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
#include<stdexcept>
#include<sstream>
#include "TreiberStack.h"
#include "ADT_Stack.h"
@@ -43,4 +44,15 @@ int TreiberStack::size() {
int c = count.load(std::memory_order_relaxed);
op_queue->enqueue(create_operation(methodname::size, c));
return c;
}
std::string TreiberStack::print_stack(){
Node* c = this->top;
std::stringstream ss;
while (c != NULL) {
ss << c->get_data() << " ";
c = c->next;
}
std::string s = ss.str();
return s.substr(0, s.find_last_not_of(" ") + 1 );
}