any proceed ban category user only?
kind futile question...
what i'm looking proceed demonstrate ban operation uses tangible user category instance i'm casting from, generates compile-time blunder there tangible ban user type. so, example, i'm looking something like:
template< typename result_type, typename input_type >
result_type operator_cast( const input_type& tvalue )
{
relapse tvalue.operator result_type();
}
// should work...
cstring sstring;
lpctstr pcszstring = operator_cast< lpctstr >( sstring );
// should fail...
int ivalue = 42;
dword dwvalue = operator_cast< dword >( ivalue );
interesting side-note: above formula crashes vs2005 c++ compiler, doesn't accumulate justly vs2008 c++ compiler due i'm guessing compiler bug, nonetheless hopefully demonstrates idea.
anybody know any proceed grasp effect?
edit: some-more rationale, explain since competence this. contend have coupling category ostensible encapsulate summary type, you're casting encapsulated type. static_cast<>, nonetheless competence work wanted destroy (ie: compiler chooses an user certified modify form asked for, wanted disaster since user present).
admittedly it's an odd case, nonetheless it's irritating i can't demonstrate accurately i wish compiler an encapsulated function... hence doubt here.
Comments
Post a Comment