Conversion operator not being pickup by compiler
Conversion operator not being pickup by compiler
- Subject: Conversion operator not being pickup by compiler
- From: "Greg Norz" <email@hidden>
- Date: Fri, 13 Jan 2006 12:55:33 -0600
- Thread-topic: Conversion operator not being pickup by compiler
Below is a VERY contrived example of some code that's generating
compiler warnings. We happen to turn on all warnings and treat them as errors,
so the code HAS to be fixed. What happens is that a classes conversion operator
is not being called (or at least the compiler can't figure it out) unless a
static_cast is placed in front of the offending variable. Consider
:
--- BEGIN ---
#include <iostream>
class Foo
{
public :
explicit Foo( const char* message ) : m_str(
message ) {}
operator const char*() { return m_str.c_str();
}
private :
std::string
m_str;
};
greg
norz
southwest
airlines || southwest.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden