Boost logo

Boost :

From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2007-02-16 11:27:30

Matthias Schabel wrote:
>>> std::cout << ((x + y) * user_selected_unit) << std::endl;
> How is this different from/better than
> std::cout << quantity<your_system::psi>(x+y) << std::endl;
> or, if you prefer,
> typedef quantity<your_system::psi> psi;
> std::cout << psi(x+y) << std::endl;
> ??

Well, like I said earlier, this solution requires a system for every
possible unit you're using. It also doesn't allow one to assign units
since they are distinct types. In order to create a runtime unit
quantity in with your plan is to use something akin to boost::any to
wrap any unit "type" into something that can be assigned to/from.

I started going that direction and realized quite quickly it's a big
mess and there isn't much need for it except the desire to do everything
in compile mode, which is unnecessary.

Boost list run by bdawes at, gregod at, cpdaniel at, john at