Skip to content

Instantly share code, notes, and snippets.

@caloni
Created April 21, 2020 16:06
Show Gist options
  • Save caloni/4479993c9fc5a2cfcc7f1df45fdbba04 to your computer and use it in GitHub Desktop.
Save caloni/4479993c9fc5a2cfcc7f1df45fdbba04 to your computer and use it in GitHub Desktop.
#include <string>
class T {
public:
inline operator std::string() const {
return "";
}
explicit inline operator uint64_t() const
{
return 10;
}
};
int main()
{
T t;
//t(); // error C2064: term does not evaluate to a function taking 0 arguments
uint64_t i = (uint64_t) t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment