Docker Quick Start
The Docker image provides a ready-to-use C++ development environment with compilers, cmake, the Universal library headers pre-installed, and command-line inspection tools on the PATH.
docker pull stillwater/universaldocker run -it --rm stillwater/universal bashWrite and compile programs using Universal directly inside the container:
#include <universal/number/posit/posit.hpp>#include <iostream>int main() { sw::universal::posit<16,2> p = 1.5; std::cout << p << '\n';}g++ -std=c++20 -I/usr/local/include/sw -o hello hello.cpp && ./helloTry the Command-Line Tools
Section titled “Try the Command-Line Tools”# Inspect IEEE-754 floating-point valuesieee 1.5
# Explore posit representationsposit 1.5
# Compare number systemspropieee 1.5See Command-Line Tools for a full reference.
Development Container
Section titled “Development Container”For a full development environment with both GCC and Clang pre-installed, use the VS Code Dev Container.
Prerequisites
Section titled “Prerequisites”- Docker
- VS Code with the Dev Containers extension
Getting started
Section titled “Getting started”- Clone the repository and open it in VS Code.
- When prompted, select Reopen in Container (or run the command
Dev Containers: Reopen in Container). - Once the container builds, open the CMake Tools preset selector and choose a preset such as
gcc-debugorclang-release. - Build and debug as usual with the CMake Tools extension.
Switching compilers
Section titled “Switching compilers”CMake presets handle compiler selection automatically. Choose gcc-* presets for GCC or clang-* presets for Clang — no manual toolchain configuration needed.