I wanted convert a mixed case string to a lower case one. And I tried
following code:
std::transform( mixedCaseString .begin(), mixedCaseString ::end(),
mixedCaseString .begin(), std::ptr_fun(to lower));
Even though I's including cctype and algorithm, I's getting compiler (g
++ 3.3.6) error:
no matching function for call to `ptr_fun(<unkno wn type>)'
I could resolve this only by using "::tolower" instead of "tolower".
But then I started googling. And it looks to me
this is not safe. And got confused with many types of responses on
similar topic.
Can someone point me what's the **safe (portable), less-cumbersome**
way to change case of an std::string
using std::transform or any other algorithm? Using boost is also
acceptable (but I've not used boost much other
than using shared_ptr and polymorphic_cas t) to me.
Regards,
~ Soumen
following code:
std::transform( mixedCaseString .begin(), mixedCaseString ::end(),
mixedCaseString .begin(), std::ptr_fun(to lower));
Even though I's including cctype and algorithm, I's getting compiler (g
++ 3.3.6) error:
no matching function for call to `ptr_fun(<unkno wn type>)'
I could resolve this only by using "::tolower" instead of "tolower".
But then I started googling. And it looks to me
this is not safe. And got confused with many types of responses on
similar topic.
Can someone point me what's the **safe (portable), less-cumbersome**
way to change case of an std::string
using std::transform or any other algorithm? Using boost is also
acceptable (but I've not used boost much other
than using shared_ptr and polymorphic_cas t) to me.
Regards,
~ Soumen
Comment