
I have been playing with things like :
quantity<variant<force, length, energy> >
That won't work because variant<...> is not a unit type. Can you post a small example of what you want to achieve?
Of course it won't work as is. But I did a bit of hacking in this direction. My aim is to be able to write something like this : any_quantity<force, length, energy> any_q = myfunction(...); ... quantity<force> = any_q; //runtime check Is there any plan to have a runtime layer above Boost.Units (like boost GIL have dynamic any_images, any_view...) ? It would check the maximum at compile time (basically check if one the variant type could match the target quantity unit) and delegates the real check at runtime (throwing an exception if the conversion fails) ? IMHO it would be a lovely addition to the current library.