Welcome to dross¶
dross is a general-purpose C++23 library providing fundamental building blocks for applications, with a focus on:
No third-party dependencies - Only the C++ standard library and the system’s threads
Modern C++ design - Leveraging C++23 features throughout
Errors in the return type -
std::optionalandstd::expectedrather than exceptions. Where a call throws, lets an exception through, or reports its outcome another way, its comment in the public headers says soPimpl idiom - Types keep their representation behind an opaque pointer, apart from
error,path,xdg,timestamp,timezoneand thedataiterators, which hold theirs directly; the ABI can change in any 0.x releaseType system - Dynamic types with value semantics
New to dross? Start here with installation instructions and a quick tutorial.
Learn how to use dross effectively with in-depth guides and best practices.
Complete API documentation for all dross modules and classes.
See dross in action with practical examples and use cases.
Core Modules¶
Type System¶
The dross type system provides dynamic typing with strong value semantics:
#include <iostream>
#include <dross/type/array.h>
#include <dross/type/dictionary.h>
#include <dross/type/value.h>
// dictionary has no initializer-list constructor
dross::dictionary dict;
dict["key"] = dross::string("value");
// Create various types
dross::value v1 = 42; // number
dross::value v2 = "hello world"; // string
dross::value v3 = dross::array{1, 2, 3}; // array
dross::value v4 = dict; // dictionary
dross::value v5 = dross::boolean{true}; // boolean
// Type checking, then casting
if (v1.is<dross::number>()) {
auto n = v1.as<dross::number>();
std::cout << "Number: " << n << std::endl; // number has operator<<
}
Platform Utilities¶
Cross-platform utilities for common operations:
#include <iostream>
#include <string>
#include <dross/platform/environment.h>
#include <dross/platform/path.h>
#include <dross/platform/xdg.h>
// Environment variables
const std::string home = dross::environment::value("HOME").value_or("/tmp");
// Path operations
const dross::path config_dir = dross::path{home}.append(".config");
std::cout << "Config: " << config_dir.string() << std::endl;
// XDG Base Directory support
dross::xdg app{"myapp"};
if (auto data_home = app.data_home()) {
std::cout << "Data: " << *data_home << std::endl;
}
Features¶
Dynamic Type System: Polymorphic value type using
std::variantUTF-8 Strings: Text held as UTF-8 bytes, with byte-oriented operations
Arbitrary Precision: Number type with string-based storage
Error Handling: Consistent use of
std::optionalandstd::expectedModern C++: Concepts, ranges, three-way comparison, and more
Platform Utilities: Cross-platform environment and filesystem operations
Installation¶
dross can be built using CMake:
# Clone the repository
git clone https://github.com/skipbit/dross.git
cd dross
# Configure and build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
# Run tests
cd build && ctest
See Getting Started for detailed installation instructions.
Contributing¶
We welcome contributions! Please see our Contributing to dross guide for details on:
Code style and conventions
Testing requirements
Submitting pull requests
Reporting issues
License¶
dross is released under the MIT License. See the LICENSE file for details.