Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2005-10-18 05:31:39


On 10/18/05, Robert Kawulak <kawulak_at_[hidden]> wrote:
> Hi,
>
> > From: Peder Holt
>
> > > The problem is double_c is not a function object type - it
> > only defines
> > > operator value_type(). If it'd also define
> > >
> > > value_type operator() ()
> > > {
> > > return static_cast<value_type>(*this);
> > > }
> > >
> >
> > The mpl numerical holder classes already define a conversion operator,
> > converting the held number to some native type defined by value_type.
> > Would it not be possible to modify your library to use the conversion
> > operator in stead?
>
> Actually, after thinking the problem over, I've came to a conclusion that
> it's not that bad idea :) I'll try to implement this, I think it may
> simplify some things.
>
> > > > To extract a runtime equivalent:
> > > > boost::mpl::runtime_value<MinValGen::value_type>(MinValGen());
> > >
> > > There's something I don't understand - what does the above
> > line do? I can't
> > > see runtime_value having a constructor?
> >
> > Sorry. Typo.
> > Should be:
> > boost::mpl::runtime_value<MinValGen::value_type>()(MinValGen());
> >
> > Basically the same as: MinValGen::value_type(MinValGen()), except not
> > all the types in mpl::math has a conversion operator (yet...)
>
> Thanks for explanation. But could you tell what is runtime_value used for?

Some "numerical holder" classes (such as rational) have a rather
complex function for extracting a runtime value. The functionality has
therefore been moved to the meta-function runtime_value instead.

The interface for mpl::math is still very dynamic, so it may be that
this construct will disappear in the future.

Regards,
Peder

>
> Best regards,
> Robert
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk