Menu

#3 Possible to pass bad types to create()

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

Factory::create():

static inline _Type*
create(_Key const& __KEY, _Type const& __THAT)
{
_Builder* __b = _S_registry().get_builder(__KEY);
return (__b) ? __b->build(__THAT) : 0;
}

Consider what happens here:

A * a = create( "B", C );

Assuming types A --> B --> C, the above code would be
invalid but would probably compile.

Discussion


Log in to post a comment.