Hasty Briefsbeta

Bilingual

C++ Library

10 months ago
  • #Programming
  • #Library Design
  • #C++
  • The author critiques C++'s standard library for being outdated and difficult to use, highlighting issues with associative containers, optional types, and iterator pairs.
  • They propose 'best', a new C++ library designed to surpass the standard library, incorporating modern features inspired by Rust and Go.
  • 'best' includes improved versions of standard library components like 'best::row' (replacing 'std::tuple'), 'best::choice' (replacing 'std::variant'), and 'best::option' (similar to Rust's 'Option').
  • The library introduces 'best::ptr' for pointer operations, 'best::span' for contiguous memory abstraction, and 'best::iter' for a Rust-like iteration model.
  • Text handling in 'best' is UTF-8 focused, with 'best::str' and 'best::strbuf' replacing 'std::string_view' and 'std::string', respectively.
  • Formatting in 'best' is inspired by Rust's 'format!', with compile-time format checking and flexible formatting options.
  • Reflection in 'best' allows for introspection of structs and enums, enabling generic operations like default formatting for aggregate structs.
  • The library includes a unit testing framework and CLI parsing tools, aiming to make C++ development more streamlined and enjoyable.
  • Future plans for 'best' include adding synchronization primitives, I/O operations, math libraries, and more OS APIs.