Order-Independent Keyword Arguments in C++26 using Reflection

2025-02-11

This blog post explores implementing order-independent keyword arguments for C++ using C++26's proposed reflection features. The author stumbled upon this technique while experimenting with reflection and shares it as a compelling demonstration of the power of these features. The post contrasts this approach with prior, less elegant solutions, including designated initializers and helper objects. The core of the post details how to leverage reflection to achieve order-independent and optional keyword arguments, providing complete code examples and explanations. This includes handling lambda expression captures and extending the fmt library for enhanced formatting capabilities.

Development Keyword Arguments