add original source
This commit is contained in:
24
source/listing_3.4.cpp
Normal file
24
source/listing_3.4.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
|
||||
struct empty_stack: std::exception
|
||||
{
|
||||
const char* what() const throw();
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class threadsafe_stack
|
||||
{
|
||||
public:
|
||||
threadsafe_stack();
|
||||
threadsafe_stack(const threadsafe_stack&);
|
||||
threadsafe_stack& operator=(const threadsafe_stack&) = delete;
|
||||
|
||||
void push(T new_value);
|
||||
std::shared_ptr<T> pop();
|
||||
void pop(T& value);
|
||||
bool empty() const;
|
||||
};
|
||||
|
||||
int main()
|
||||
{}
|
||||
Reference in New Issue
Block a user