For a specific example, consider atoi(const std::string &). This is very frustrating, since we as programmers would need to use it so much.
Even in C, using atoi isn't a good thing to do for converting user input. It doesn't provide error checking at all. Providing a C++ version of it wouldn't be all that useful - considering that it wouldn't throw and do anything, you can just pass .c_str() to it and use it.
Instead you should use strtol in C code, which does do error checking. In C++03, you can use stringstreams to do the same, but their use is error-prone: What exactly do you need to check for? .bad(), .fail(), or .eof()? How do you eat up remaining whitespace? What about formatting flags? Such questions shouldn't bother the average user, that just want to convert his string. boost::lexical_cast does do a good job, but incidentally, C++0x adds utility functions to facilitate fast and safe conversions, through C++ wrappers that can throw if conversion failed:
int stoi(const string& str, size_t *idx = 0, int base = 10); long stol(const string& str, size_t *idx = 0, int base = 10); unsigned long stoul(const string& str, size_t *idx = 0, int base = 10); long long stoll(const string& str, size_t *idx = 0, int base = 10); unsigned long long stoull(const string& str, size_t *idx = 0, int base = 10);Effects: the first two functions call
strtol(str.c_str(), ptr, base), and the last three functions callstrtoul(str.c_str(), ptr, base),strtoll(str.c_str(), ptr, base), andstrtoull(str.c_str(), ptr, base), respectively. Each function returns the converted result, if any. The argumentptrdesignates a pointer to an object internal to the function that is used to determine what to store at*idx. If the function does not throw an exception andidx != 0, the function stores in*idxthe index of the first unconverted element of str.Returns: the converted result.
Throws:
invalid_argumentifstrtol,strtoul,strtoll, orstrtoullreports that no conversion could be performed. Throwsout_of_rangeif the converted value is outside the range of representable values for the return type.