Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2003-06-23 14:03:34

On Fri, 20 Jun 2003 17:56:51 +0200, Gennaro Prota wrote:

> Yes. Just to stimulate discussion, and without any offence towards
> Daniel's solution, this is an approach without the conversion function
> and the operator overloads. Beware that it's completely untested.
> [snip]
> It's not so "advanced" as it might appear at first sight. Maybe the
> rigmarole above, together with the comments in the alternative solution,
> is of some help to realize that the basic ideas are very simple.

I looked at the code and I see two problems:

a) as<T>() is not generic, static_cast<T>() is. Why introduce a new syntax
for an already known language construct? Is it just that you wanted to
create some "explicit cast"? I suggested explicit casts in clc++m long
time ago :) Note that in my design the template operator T() is as close
to an explicit cast as you can get with todays C++ and still create a
generic interface. as<T>() is IMHO not an option as other libraries will
call it convert<T>(), explicit_cast<T>() or whatever.

b) The "single line to create a useful interface" is now splittet into
more lines. Why? It's a drawback and doesn't help the design in my eyes. I
actually wonder what the code tries to do better. Removing the operators
is not a big deal and I don't agree they should be removed, but I guess
you had something else in mind when writing this code. Could you
elaborate, please?

Regards, Daniel

Boost list run by bdawes at, gregod at, cpdaniel at, john at