>From: "Daniel Frey" <[EMAIL PROTECTED]>

> On Sun, 22 Jun 2003 03:32:52 +0200, Terje Slettebų wrote:
> >
> > --- Start ---
> >
> > #include <iostream>
> >
> > #define BOOST_DEFINE_MATH_CONSTANT(name)\ const struct name##_type\
> > {\
> >   name##_type() {}\
> >   template<class T>\
> >   operator T() const;\
> > } name;
> >
> > #define BOOST_MATH_CONSTANT_VALUE(name, type, value)\
> > template<>\
> > name##_type::operator type() const { return value; }
> >
> > --- End ---
> >
> > My question is: Is there any reason why it can't be done this simple?
>
> Yes. AFAICS wrong use of your constants with unsupported types is only
> cought at link-time, not at compile-time. This is IMHO a big problem, big
> enough to reject this approach.

Ok. So maybe an extra level of indirection, as in your code (and
Kenniston's) may be preferable. I was wondering what was the point with it.
:)

Another thing, are the ADD_OPERATOR macro in your code necessary? It
compiles fine without it on Intel C++ 7.1.

> Also, I'm not sure whether it's standard compliant code.

I think it is. It specialises a member. What could be the problem with this?
As you say, errors are caught at link time.


Regards,

Terje

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to