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 <cstdlib> | |
#ifndef NDEBUG | |
#define my_assert(x) { x ? static_cast<void>(x) : std::abort(); } | |
#else | |
#define my_assert(x) static_cast<void>(x) | |
#endif | |
class Foo { | |
public: |
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 "FreeRTOS.h" | |
extern "C" { | |
#include "task.h" | |
} | |
#include <atomic> | |
#include <cstdint> | |
#include <gtest/gtest.h> |
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 <iostream> | |
#include <functional> | |
#include <unordered_map> | |
#include <utility> | |
template <typename IN_TYPE, typename OUT_TYPE> | |
std::function<OUT_TYPE(IN_TYPE)> memoize(OUT_TYPE(*f)(IN_TYPE)) | |
{ | |
std::unordered_map<IN_TYPE, OUT_TYPE> storage; | |
return [f, storage](IN_TYPE x) mutable -> OUT_TYPE |
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 <iterator> | |
template<typename T, typename SIZE_TYPE = size_t> | |
class CircularBuffer | |
{ | |
public: | |
CircularBuffer(SIZE_TYPE capacity) | |
: _capacityPlusOne{ capacity + 1 } | |
, _buffer{ new T[_capacityPlusOne] } | |
, _head{ 0 } |
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 <iostream> | |
#include <memory> | |
using namespace std; | |
class Widget : public std::enable_shared_from_this<Widget> | |
{ | |
public: | |
template<typename... Ts> | |
static std::shared_ptr<Widget> Create(Ts&&... params) |