This would be to resolve BobSteagall/wg21#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 would be to resolve BobSteagall/wg21#36 in this library.
The idea is to have a customization point similar to
quantity_like_traits. It'd be something likequantity_value_traits, with asizefor the number of components and an indexed observer for the components.So given
struct vector2d { int x; int y; }, you could specialize it:Very much like structured bindings. Then, the as-of-yet unnamed
quantity_prefixed wrapper would acceptquantity_value_traits::sizepairs 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>;