Boost logo

Boost :

From: Corwin Joy (cjoy_at_[hidden])
Date: 2001-07-20 16:17:44


----- Original Message -----
From: "Kevlin Henney" <kevlin_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, July 20, 2001 10:13 AM
Subject: [boost] Proposal: converting casts for 'any'

> > From: "Corwin Joy" <cjoy_at_[hidden]>
> >
> >I have uploaded to the boost website a set of files for registering and
> >performing conversion casts with an 'any' object into the folder
any_ccast.
> >This can be done without making modifications to the current 'any'
> >structure. The syntax for this cast looks like this:
>
> This seems to be a potentially useful direction for the conversions
> library in general. For instance, a customisable conversion from A to B,
> with any as a specific example of implementation.

This sounds like a cool idea with some good potential. I'm not quite sure I
can visualize / understand exactly how this would work. On the one hand --
to do the 'any' conversions I had to dig into the structure of the any class
a bit so in that sense what I have done is specialized. On the other hand,
if you don't have an 'any' type class and know the exact type it seems like
you would be better off using a templated cast such as numeric_cast
directly. But, hopefully I am just missing the point here?
>
> >any_ccast ('any' converting cast)
> >
> >template<typename ValueType>
> > ValueType any_ccast(const any & operand);
>
> Perhaps a different name, which kind of leads into... have you
> investigated the possibility of generalising the mechanism beyond any as
> the source type?

Umm.. again I'm not quite sure I understand what you are talking about. I
have however thought about the idea of an 'any object' which I think would
be very cool. See my next post for details.

Corwin


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