From: Anthony Liguori (anthony_at_[hidden])
Date: 2003-09-08 21:56:04
Rob & Lori wrote:
> Anthony, I took a look at your work, and I quite like it. I am
> actually doing something very similar to the current version of my
> pluggable factory class (which I've yet to upload to the boost files
> section) except it never occured to me that the ctor_fn would be
> useful outside the factory class. It seems only obvious now.
Why thank you :-) Must admit I haven't taken a look at your factory
class yet although I am quite curious.
> Personally, I think a ctor_fn implementation should be part of boost,
> but it seems not too many people are interested in such a feature,
> just like factory classes. I'm still trying to figure out why. Heck,
> there are a few boost libraries which have implemented ctor_fn like
> functionality for their own internal use. You'd think it would be
> about time that we made it officially part of the library.
I don't think it's for lack of interest. It's just sufficiently
difficult to get right and I haven't invested nearly enough time into.
The basic problem is that you really want ctor_fn to be able to map any
constructor. The currently version can make the constructor signature
just fine but what would be really nice is to map any overloaded new
For instance, for something like:
A *a = new(mem) A(42);
You really want to be able to express as something like:
function<function<A *(int)> (void *)> func = boost::new_fn<function<A
*(int)> (void *)>();
A *a = func(mem)(42);
The second line (declaration of func) is not necessarily the best syntax
for it but something along those lines. Every attempt I've made to try
to simulate this ability has failed so far. I'm not totally convinced
it's impossible though so I'm sort of waiting for some inspiration
(unless someone else has an idea of how such a thing could be achieved).
I'd really like to wait to formally submit a proposal until a solution
to overloaded new operators is found.
> Rob Geiman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk