Menu

#4 unneeded create() overloads?

open
nobody
None
5
2004-06-04
2004-06-04
No

Regarding these create() overloads:

template <typename _SubType>
static inline _Type*
create(_Key const& __KEY, Constructor<_SubType>&
__constructor)
{
_Builder* __b = _S_registry().get_builder(__KEY);
return (__b) ? __b->custom_build(__constructor) :
0;
}

template <typename _SubType>
static inline _Type*
create(_Key const& __KEY, Constructor<_SubType>
const& __CONSTRUCTOR)
{
_Builder* __b = _S_registry().get_builder(__KEY);
return (__b) ?
__b->custom_build(__CONSTRUCTOR) : 0;
}

These seem to be completely unnecessary: If we KNOW in
advance what ctor we're using, which we do in these cases,
it seems to be unnecessary to call b->custom_build(ctor).
Why not simply call the ctor directly?

Discussion


Log in to post a comment.