Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2005-10-18 03:16:54


On 10/14/05, Robert Kawulak <kawulak_at_[hidden]> wrote:
> Hi,
>
> > From: Peder Holt
>
> > It would perhaps be a good idea to use mpl::int_<> instead of
> > give_number<> to specify a constraint limit.
>
> But the point is that give_number is a function object type, it can't be
> replaced with a template metafunction. If one wants to have integral bounds,
> he may use bounded_int which takes integral constants as its parameters.
>
> > You can also use mpl::math::double_c<> (available from the file vault:
> > Template Metaprogramming/mpl_math.zip)
>
> 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?
I don't think modifying mpl for this is a good idea...

> then it would be usable in this case. Maybe you'll consider the possibility
> to add this operator to double_c?
>
> > 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...)

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