A single-file header-only C++ library providing a type-safe container for single values of any type, compatible with C++98 and later.
any-lite is a single-file header-only C++ library that implements a type-safe container capable of holding a single value of any type, similar to C++17's `std::any`. It solves the problem of handling heterogeneous data in a type-safe manner, especially in codebases that need to support older C++ standards like C++98 or C++11.
C++ developers working on cross-platform or legacy projects who need a portable, dependency-free `any` container, as well as library authors seeking a lightweight alternative to Boost.Any.
Developers choose any-lite for its extreme portability, header-only simplicity, and seamless fallback to `std::any` when available, making it ideal for projects that must compile across multiple C++ standards without external dependencies.
any lite - A C++17-like any, a type-safe container for single values of any type for C++98, C++11 and later in a single-file header-only library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Easy integration as a single include file with no external dependencies, making it straightforward to add to any C++ project without complex build systems.
Works seamlessly from C++98 to C++17, automatically using std::any when available, ensuring compatibility across decades of C++ compilers and standards.
Provides a nonstd::any class with any_cast for safe storage and retrieval of any type, mirroring C++17's std::any behavior for robust heterogeneous data handling.
Supports macros to disable exceptions, select between std::any and nonstd::any, and tweak compilation, offering adaptability for diverse project constraints.
All contained objects are dynamically allocated, leading to potential performance overhead for small or frequently accessed types, as admitted in the README's limitations section.
Move construction, move assignment, and emplacement are not supported in C++98, restricting functionality for legacy projects that need these modern C++ features.
Relies on compile-time macros for configuration, which can be error-prone and add complexity to build systems, especially for beginners or teams unfamiliar with macro-based tweaks.