Skip to content

A clean and lean reimagining of the C++ standard library

License

Notifications You must be signed in to change notification settings

drlight-code/clean-core

This branch is 10 commits behind project-arcana/clean-core:develop.

Folders and files

NameName
Last commit message
Last commit date
Mar 20, 2024
Sep 20, 2024
Nov 10, 2023
Feb 22, 2024
Mar 30, 2019
Mar 20, 2024
Apr 9, 2020
Mar 30, 2019
Oct 27, 2019
Oct 10, 2022

Repository files navigation

clean-core

clean-core (cc) is a clean and lean reimagining of the C++ standard library.

Goals

  • significantly faster to compile than std
  • forward declaration for all public types
  • no slower than std
  • safer than std
  • more modular header design (each type can be separately included)
  • convenient interfacing with code using std types
  • removal of unintuitive behavior (e.g. vector<bool> or optional::operator bool)
  • mostly keeping naming scheme and intent of std
  • better debugging support and performance
  • no dependency on exceptions

Requirements / Dependencies

  • a C++17 compiler
  • a few std features (that are hard to otherwise implement)

Allowed std includes

  • <cstring> (1ms, for memcpy)
  • <cstddef> (1ms, for some types)
  • <type_traits> (5-8ms, many not implementable ourselves)
  • <utility> (10-15ms, swap, declval, NOTE: cc has own move and forward)
  • <atomic> (20ms, hard to implement ourselves)

Notable Changes

Changes that were rarely used features that increased implementation cost immensely:

  • no allocators
  • no custom deleters for unique_ptr

Error-prone and unintuitive or suprising features:

  • no specialized vector<bool>
  • no operator bool for optional<T>
  • no operator< for optional<T>

Others:

  • no strong exception support
  • no iterator-pair library, only ranges
  • no unreadable _UglyCase (leaking non-caps macros is a sin)
  • traits types and values are not suffixed with _t or _v
  • no volatile support
  • no unique_ptr<T[]>
  • some interfaces are stricter to prevent easy mistakes

New Features

  • span (strided array view)
  • flat_ containers
  • inline_ types (no heap allocs)
  • customizable low-impact assert
  • internal assertions (optional)
    • bound-checked containers
    • null checks for smart pointer
    • contract checks

TODO

  • big list of comparison between std and cc
    • name of feature/class (e.g. pair)
    • header name of std/cc
    • parse time std/cc
    • preprocessed, significant LOC of std/cc

About

A clean and lean reimagining of the C++ standard library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.0%
  • CMake 2.0%