idealvin/coost

Public

A lightweight C++ base library with Go-style coroutines.

  • Stars4.2k+4 tuần này
  • Forks593
  • Watchers135
  • Issues1
  • Ngày tạo10/11/2019
  • Cập nhật gần nhất28/10/2026
  • Ngôn ngữC++
  • Giấy phép—
readme.md31.9 KBRaw

coost

简体中文 | English
Linux Mac Windows Windows-arm64 FreeBSD Release License: MIT

A tasteful, minimal C++ base library.

Introduction

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.

Commercial Support

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:

👉 coost Commercial Support

Contact the author via GitHub Issues or email [email protected]. A free initial diagnosis is available to assess scope and feasibility.

Documentation

Core Components

flag

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;
}

Coroutines

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) {
    

Nội dung README thuộc về idealvin và cộng đồng đóng góp, giấy phép Không có giấy phép. Nguồn: github.com/idealvin/coost