From: Matthias Schabel (boost_at_[hidden])
Date: 2007-02-12 17:45:12
>> Not necessarily. static_multiply has to be
>> able to operate on an mpl::list.
> I don't know where you come up with that requirement. It certainly
> makes sense to me that if you have a library that is as intimately
> with MPL as this one is that you use the standards created by the MPL.
As Steven pointed out, this is not a detail - how would you write a
specialization of mpl::times<> that works for an arbitrary mpl::list?
my own compile time operators, I can default to mpl lists and
> quantinty<SI::length> l = 1.5 * ft;
> And no I don't really think ft being a quantity is adequate.
You can already do this. Define an imperial unit system with ft as
of length, then specialize the conversion_helper template:
class conversion_helper< quantity<unit<imperial::system,length_type>,Y>,
convert(const quantity<unit<imperial::system,length_type>,Y>& source)
static const unit<imperial::system,length_type> ft;
With conversion_helper, you can define basically arbitrary quantity
conversions between any two quantities
(even if they are not dimensionally congruent, if you want, which can
be useful in natural unit systems, for example)...
> quantity<SI::length> cent(cents);
> cent = 2 * meters;
> assert(cent.value() == 200);
I have no idea what this means. Cents == centimeters? If so,
centimeter is not an SI unit of length. And with no
value, the first line doesn't give you a quantity anyway...
> quantity<SI::length> unknown(user_unit);
> unknown = 5 * meters;
> quantity<SI::length> m(meters);
> m = unknown;
> assert(m.value() == 5);
> void f_cgs(quantity<CGS::length> l);
> The syntax is not necessarily what mcs does or would do but the
> are what is important.
> It's been argued that this adds unnecessary complexity or would cause
> inefficiencies. I don't agree.
I'm sorry to say that I can't make heads or tails out of what you
want here. I would need some real functioning C++
code demonstrating what you think you need to say whether I think
it's possible within the existing framework of