简体中文 | English
A tasteful, minimal C++ base library.
coost is a lightweight, high-performance, easy-to-use C++ base library. It supports Linux, macOS, Windows, FreeBSD, and CPU architectures such as x86, x64, ARM, and ARM64.
coost, abbreviated as co, includes go-style coroutines, networking, logging, config parsing, unit testing, benchmarking, memory allocator, and other components. Its goal is to make C++ programming simple and enjoyable.
coost remains open source. If you use coost in production and need in-depth support such as custom development, architecture adaptation (RISC-V / MIPS), coroutine hooks, performance optimization, or team training, the author offers paid commercial support to reduce risk and save time.
For service packages, pricing, and process, see:
Contact the author via GitHub Issues or email [email protected]. A free initial diagnosis is available to assess scope and feasibility.
flag is a command-line argument and config file parsing library. It supports flag aliases, automatic config file generation, and more.
#include "co/flag.h"
#include "co/print.h"
DEF_bool(x, false, "Comment here");
DEF_int32(n, 0, "Comment here");
DEF_string(s, "hello world", "Comment here");
int main(int argc, char** argv) {
flag::parse(argc, argv);
co::println("x: ", FLG_x);
co::println("n: ", FLG_n);
co::println("s: ", FLG_s);
return 0;
}coost implements a coroutine mechanism similar to goroutine in Golang. It has the following features:
- Multi-thread scheduling. By default, the number of scheduling threads is the number of CPU cores.
- Shared stacks. Coroutines in the same thread share several stacks (default size 1MB), resulting in low memory usage.
- Supports coroutine synchronization events, coroutine locks, waitgroup.
#include "co/co.h"
#include "co/flag.h"
#include "co/print.h"
int main(int argc, char** argv) {