This file contains 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 <condition_variable> | |
#include <functional> | |
#include <iostream> | |
#include <mutex> | |
#include <queue> | |
#include <thread> | |
#include <vector> | |
namespace demo | |
{ |
This file contains 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
/*** | |
https://en.cppreference.com/w/cpp/container | |
*/ | |
/*** | |
Задача стандартной библиотеки -- быть стандартной библиотекой. |
This file contains 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
/*** | |
Класс std::thread | |
*/ | |
#include <iostream> | |
#include <thread> | |
void SayHello() |
This file contains 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
/*** | |
SFINAE: Substitution failure is not an error | |
*/ | |
// В основном базируется на std::enable_if | |
// https://en.cppreference.com/w/cpp/types/enable_if | |
#include <type_traits> |
This file contains 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
/*** | |
Реализация шаблона должна быть доступна компилятору. | |
Поэтому шаблоны размещают в .hpp-файлах | |
*/ | |
///////////////////////////////////////////////////// | |
/*** |
This file contains 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 <so_5/all.hpp> | |
namespace example | |
{ | |
class a_stats_listener_t final : public so_5::agent_t | |
{ | |
public : | |
a_stats_listener_t( context_t ctx ) | |
: so_5::agent_t( std::move(ctx) ) |
This file contains 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 <so_5/all.hpp> | |
#include <iostream> | |
class shutdown_initiated final : public so_5::signal_t {}; | |
class my_stop_guard final : public so_5::stop_guard_t | |
{ | |
const so_5::mbox_t m_dest; |
This file contains 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
class meeting_room_t { | |
std::mutex lock_; | |
std::condition_variable wakeup_cv_; | |
unsigned attenders_{}; | |
public: | |
meeting_room_t() = default; | |
void enter() { |
This file contains 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 <chrono> | |
#include <iostream> | |
#include <string> | |
#include <variant> | |
namespace isdefault_benchmark | |
{ | |
class time_meter_t | |
{ |
This file contains 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 <so_5/all.hpp> | |
struct m1 final : public so_5::signal_t {}; | |
struct m2 final : public so_5::signal_t {}; | |
struct m3 final : public so_5::signal_t {}; | |
struct done final : public so_5::signal_t {}; | |
class A final : public so_5::agent_t | |
{ | |
public: |
NewerOlder