R
Ramon F. Herrera
I was flabbergasted the first time I used an IDE that had the "period
completion" feature (or the similar, "left parenthesis"). It made me
considering leaving old trusted "vi".
The problem with the period is that it only goes one step deep: more
steps are needed! Additionally, sometimes the period is not the answer
to your travails, when a non-member function is the one that will
convert from type "A" to type "B".
When I was learning Java, a large number of questions (and time
wasted) that I posted were of the form:
"How do I convert [some type] to [some other type]?"
The text conversions alone occupy an inordinate amount of time to
programmers (just try Google to see what I mean).
Some C++ examples:
I had been using for a long time this (from Boost::Filesystem):
string somestring = "abc/de";
path p = path(somestring);
Only to realize, accidentally, that the conversion is done
automatically. The IDE should help you in those cases:
path p = somestring;
This one made me kick myself. I used this many, many times:
const char* sometext = somestring.string().c_str();
Well, it turns out that this one is just as good:
const char* sometext = somestring.c_str();
My question is about R&D done in this particular field. I tried Google
but the word "type" is too ambiguous.
This problem is very similar to the resolution of Rubik's Cube. Your
expression is in some "scrambled" state and you need the computer to
tell you -not only any path! mind you- but the shortest path (known as
God's algorithm) to the desired type. Exhaustive, aka brute force
search can be used: after all, we are not talking Rubik type of steps,
most of the time we are 1 or 2 steps away from the conversion.
Regards,
-Ramon
completion" feature (or the similar, "left parenthesis"). It made me
considering leaving old trusted "vi".
The problem with the period is that it only goes one step deep: more
steps are needed! Additionally, sometimes the period is not the answer
to your travails, when a non-member function is the one that will
convert from type "A" to type "B".
When I was learning Java, a large number of questions (and time
wasted) that I posted were of the form:
"How do I convert [some type] to [some other type]?"
The text conversions alone occupy an inordinate amount of time to
programmers (just try Google to see what I mean).
Some C++ examples:
I had been using for a long time this (from Boost::Filesystem):
string somestring = "abc/de";
path p = path(somestring);
Only to realize, accidentally, that the conversion is done
automatically. The IDE should help you in those cases:
path p = somestring;
This one made me kick myself. I used this many, many times:
const char* sometext = somestring.string().c_str();
Well, it turns out that this one is just as good:
const char* sometext = somestring.c_str();
My question is about R&D done in this particular field. I tried Google
but the word "type" is too ambiguous.
This problem is very similar to the resolution of Rubik's Cube. Your
expression is in some "scrambled" state and you need the computer to
tell you -not only any path! mind you- but the shortest path (known as
God's algorithm) to the desired type. Exhaustive, aka brute force
search can be used: after all, we are not talking Rubik type of steps,
most of the time we are 1 or 2 steps away from the conversion.
Regards,
-Ramon