Header only implementation of boolean in modern C++
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
using token_t = std::string; | |
using tokens_t = std::vector<std::string>; | |
static inline auto tokenize(const std::string &line, char delimiter) -> tokens_t { | |
auto tokens = tokens_t{}; | |
auto ss = std::stringstream{line}; | |
auto token = token_t{}; | |
while (std::getline(ss, token, delimiter)) { | |
if (!token.empty()) { | |
tokens.push_back(token); |
Header only implementation of hashtable in C++20
Members | Descriptions |
---|---|
class HashTable |
hashtable data structure |
class HashTable::Node |
hashtable node data structure |
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 <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <map> | |
#include <numeric> | |
#include <sstream> | |
#include <utility> | |
template<class t_pair> |
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
CXX?=g++ | |
BIN?=main | |
EXT?=cpp | |
LINKS?=pthread | |
CXXSTD?=c++17 | |
SRCS=$(shell find . -name "*."$(EXT)) | |
DIRS=$(shell find ./* -type d) | |
OBJS=$(patsubst %.$(EXT),%.o,$(SRCS)) |
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
#ifndef MY_STD_ACCUMULATE_H | |
#define MY_STD_ACCUMULATE_H | |
namespace my_std { | |
template<class InputIt, class T, class BinaryOperation> | |
inline auto accumulate(InputIt first, InputIt last, T init, BinaryOperation op) -> T { | |
for (; first < last; ++first) { | |
init = op(std::move(init), *first); | |
} | |
return init; |
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
from .singleton import Singleton | |
class Example(metaclass=Singleton): | |
""" | |
Example class. | |
""" | |
pass | |
def main(): |
NewerOlder