Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
amusing overload choice
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x86 #include <iostream> struct MyClass { MyClass() : mStr("I'm a string") {} inline operator int() const { return 5; } inline operator const char*() const { return mStr.c_str(); } protected: std::string mStr; }; void myfunc() { MyClass c; std::cout << c << std::endl; } int main() { std::cout << "Hello, world!\n"; myfunc(); }
run
|
edit
|
history
|
help
0
no-thread
auto decltype - Return Type Decltype
#22.2
What exactly is “broken” with Microsoft Visual C++'s two-phase template instantiation?
7
dynamic_cast in assert Causing Error
Error defining lambda inside namespace
students grade
default
pi