This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mutex> | |
#include <thread> | |
#include <iostream> | |
struct Singleton | |
{ | |
static Singleton& instance() | |
{ | |
std::lock_guard<std::mutex> lock(m); | |
static Singleton s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <deque> | |
#include <stack> | |
#include <mutex> | |
#include <thread> | |
#include <algorithm> | |
#include <functional> | |
#include <type_traits> | |
#include <unordered_map> | |
#include <condition_variable> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <initializer_list> | |
#include <stdexcept> | |
template <class T> | |
class list; | |
template <class T> | |
class Node | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sstream> | |
#include <iostream> | |
template<typename Tag, typename Tag::type M> | |
struct grant_access | |
{ | |
friend typename Tag::type get(Tag) { return M; } | |
}; | |
template<class cT, long n> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
template <class T> | |
class circular_linked_list | |
{ | |
struct node; | |
node* tail{nullptr}, **back_ptr{&tail}, **front_ptr{nullptr}; | |
int m_size{0}; | |
template <class U> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Node* DeleteNode(Node*& head, int value) | |
{ | |
Node** ptr = &head, *next; | |
while (*ptr && (*ptr)->data != value) | |
ptr = &(*ptr)->next; | |
if (!*ptr) | |
return NULL; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class Node | |
{ | |
public: | |
Node(int data, Node* left = nullptr, Node* right = nullptr) | |
: data(data) | |
, left(left) | |
, right(right) | |
{ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <fstream> | |
class insertbuf : public std::streambuf | |
{ | |
public: | |
insertbuf(std::ostream& os, std::string const& data) | |
: m_stream(os) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdexcept> | |
template <class T> | |
class LinkedList; | |
template <class T> | |
class ListElement | |
{ | |
friend LinkedList<T>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdexcept> | |
template <class T> | |
class Array | |
{ | |
public: | |
Array(); | |
Array(unsigned int, unsigned int = 0); | |
Array(Array const&); | |
~Array(); |