feat: customization point to define the components of a QuantityValue
This would be to resolve https://github.com/BobSteagall/wg21/issues/36 in this library.
The idea is to have a customization point similar to quantity_like_traits. It'd be something like quantity_value_traits, with a size for the number of components and an indexed observer for the components.
So given struct vector2d { int x; int y; }, you could specialize it:
struct units::quantity_value_traits<vector2d> {
static constexpr int size{2};
template<int I> int get(const vector2d&);
};
Very much like structured bindings. Then, the as-of-yet unnamed quantity_ prefixed wrapper would accept quantity_value_traits::size pairs of template parameter for the dimension/kind and unit of each component in order.
using quantity_vector2d = units::quantity_unnamed<si::dim_length, si::metre, si::dim_acceleration, si::metre_per_second, vector2d>;
This'd be a generic solution, so expect ugly observers like get<0>(q), like std::tuple.
I think I'd prefer to live with a variety of types with very similar definitions than use this. Each would be named appropriately (with improved error messages), and have the best observer like .x. Until we get metaclasses and can get rid of most of the repetition.
Related to #23. I intend to do the homework based on https://github.com/mpusz/units/issues/23#issuecomment-589166416 soon.