
24 May
2011
24 May
'11
1:53 p.m.
On Tue, May 24, 2011 at 1:41 PM, Krzysztof Czainski <1czajnik@gmail.com>wrote:
The compiler sais "cannot convert 'const C' to 'int'. I think it means static_cast<> takes c as a const, and your conversion operator is not a const member, so the compiler cannot use it. Solution (not tested):
operator optional<int>() const { return none; }
That doesn't work either, nor does cout << ( optional<int> ) c << endl; but this does cout << c.operator optional<int>( ) << endl; But I guess that's not really what you're looking for. HTH - Rob.