A minimal C++23 project template using Bazel build system to explore and experiment with modern C++ features.
- Zero Installation Compiler: Bazel automatically downloads LLVM 20.1.3 toolchain into its cache - no need to install a compiler on your system!
- Modern C++ Standards: Configured for C++23
- Hermetic Builds: Reproducible builds across different machines using the same cached toolchain
- Bazel Build System: Fast, incremental builds using Bzlmod
- Example Code: Demonstrates C++23 concepts with numeric type constraints
- Bazel (latest version recommended)
- That's it! No compiler installation needed - Bazel handles everything
# Build the project (first run will download LLVM toolchain into Bazel cache)
bazel build //:main
# Run the executable
bazel run //:mainNote: On the first build, Bazel will download the LLVM 20.1.3 toolchain (~200MB) into its cache. This is a one-time operation. Subsequent builds will use the cached toolchain.
cpp23-playground/
├── BUILD.bazel # Bazel build configuration
├── MODULE.bazel # Bazel module definition
├── MODULE.bazel.lock # Dependency lock file
├── .bazelrc # Bazel configuration options
├── main.cpp # Example C++23 code
└── README.md # This file
The example code demonstrates:
- C++23 Concepts: Custom
Numericconcept using type constraints - Abbreviated Function Templates: Using
autoparameters with concepts - Modern Type Traits:
std::integralandstd::floating_point
To add new C++23 examples:
- Create a new
.cppfile - Add it to
BUILD.bazel:cc_binary( name = "your_example", srcs = ["your_example.cpp"], )
- Build and run:
bazel run //:your_example
MIT License - feel free to use this as a template for your own C++23 projects.
This is a personal playground, but suggestions for interesting C++23 examples are welcome!