Hey guys,
Could I "teach" my compiler to do automatic type conversions for me?
So when I have this program:
#include <cstdio>
#include <string>
using std::string;
int main(){
int x;
string y = "1234567890";
x = y;
printf("y: %s == %d\n", y.c_str(), x);
return 0;
}
It won't give me main.cpp|10|error: cannot convert `std::string' to `int' in assignment|
But compile and do everything alright? I know C++ has this function somewhere since it can do a lot of conversions without having to use functions on the line itself (i.e. by simply casting), but I couldn't find details about it.
Thanks in advance,