
Tobias Schwinger wrote:
Andrey Semashev wrote:
Hello Tobias,
Tuesday, April 3, 2007, 9:02:45 PM, you wrote:
Hi, in_place_factory can be quite useful, as I found out recently. However, here are some suggestions to make it event better: 1. add a construction mechanism for arrays 2. add a note to the docs about deduction and using boost::ref 3. have the static 'apply' member function return the pointer to the constructed object - just like the placement new operator 4. use file iteration instead of BOOST_PP_REPEAT for maintainability If I may, I'd like to add:
5. add in_place_factory and typed_in_place_factory for zero constructor arguments.
Quick discussion:
Often the reason against nullary function overloads is the earlier point of instantiation (nullary functions can't be templates), but that shouldn't be the problem here because 'in_place_factory's nested 'apply' is a template and 'typed_in_place_factory' is complete enough to be instantiated. For the 'inline in_place_factory0 in_place()' function the explicit 'inline' keyword is needed, however, not to break the ODR.
OK. It seems reasonable and it seems there are no unsolvable problems around, so let's add it ;-).
I remember someone mentioned this before, but I can't remember any one answered.
That probably means that there's no maintainer. If that's so, I'd pick up this role.
Well, not really. Seems Fernando Cacciola is still boosting actively (I'm CC ing this post to his hotmail address). However, I have implemented the proposed code changes (see preliminary patch attached to this message) - hoping for Fernando's OK. Regards, Tobias