"Andy Little" <andy@servocomm.freeserve.co.uk> writes:
For addition you would need to do this:
nocast(a) + nocast(b);
for multiplication
nocast(a) * nocast(b);
Seems like one should be enough to prevent promotion and implicit combinations: nocast(a) * b
You could make this a general purpose utility:
template <typename T> struct no_caster{ T t; /*...*/ };
Alright, now you've gone too far. The name is taken. http://www.fender.com/products/search.php?partno=0150302867
template <typename T1, typename T2> typename boost:enable_if< boost::is_same<T1, T2>,T1
::type
operator Op (nocaster<T1> ,nocaster<T2>);
You might do it with expression templates to get: x [strict]= y + z * b; Or just encode the restriction in the type of x. -- Dave Abrahams Boost Consulting www.boost-consulting.com