[bind] and [function] : question on binding member function
Hi,
can someone explain to me why the following code crashes at the third
call to "a.call_func" when "str" is dereferenced? Should'nt it crash
when "this" is dereferenced?
Thanks in advance.
typedef boost::function
can someone explain to me why the following code crashes at the third call to "a.call_func" when "str" is dereferenced? Should'nt it crash when "this" is dereferenced?
IIRC, it's undefined behavior, so it shouldn't anything. But in practice, I guess the compiler just ommits &* in "&*this", so there's no reason for crash.
Add copy constructor: B::B( const B& src ) : str( new std::string( *src.str ) ) { } -- Regards, Ivan Kharin
participants (3)
-
Igor R
-
Ivan Kharin
-
Moritz