ITNOA
There have been significant changes from C++03 to C++26 that fundamentally affect API design in C++.
Consequently, I propose designing a new API for program_options based on C++26 best practices.
Key modern C++ features we can leverage include:
- Modules: For faster build times and cleaner library exposure.
- Concepts: For improved template metaprogramming and clearer constraints.
- Contracts: For more robust code and runtime/compile-time assertions.
std::optional: For a more declarative API when handling optional values.
std::variant & std::any: For type-safe, flexible option storage.
- Structured Bindings: For a cleaner, more intuitive API when unpacking values.
std::span & std::string_view: For zero-copy, high-performance string and array views.
std::expected: For modern, expressive error handling instead of exceptions or return codes.
- Compile-Time Reflection: For smarter, automatic type inference and a significantly cleaner API footprint.
To achieve this, we should redesign the public API in a C++26-native way and modernize the underlying codebase.
To make this actionable, I suggest the following roadmap:
ITNOA
There have been significant changes from C++03 to C++26 that fundamentally affect API design in C++.
Consequently, I propose designing a new API for
program_optionsbased on C++26 best practices.Key modern C++ features we can leverage include:
std::optional: For a more declarative API when handling optional values.std::variant&std::any: For type-safe, flexible option storage.std::span&std::string_view: For zero-copy, high-performance string and array views.std::expected: For modern, expressive error handling instead of exceptions or return codes.To achieve this, we should redesign the public API in a C++26-native way and modernize the underlying codebase.
To make this actionable, I suggest the following roadmap: