|
-
July 21st, 2010, 02:02 AM
#9
Re: [g++] Getting an error while using reinterpret_cast operator
 Originally Posted by Lindley
In this case, :: tells the compiler to use the version in the global namespace, which is the C version.
Don't forget that I've used use namespace std;, so now, global namespace = std namespace...
 Originally Posted by kempofighter
I prefer to just type the namespace each time or add the using declaration at function scope for the specific things
Using declaration is something like this ?
Code:
using std::cout;
using std::cin;
 Originally Posted by laserlight
after considering what the standard guarantees about <cctype>, I decided that a better approach is to write a function object wrapper for tolower.
Is it what you had in mind ? 
Code:
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
using namespace std;
char my_tolower(char c)
{
return tolower(c);
}
//-------------------------------------------
int main()
{
string a;
transform(a.begin(), a.end(),
a.begin(), my_tolower);
}
//-------------------------------------------
 Originally Posted by laserlight
Now, the next question: what's with the difference between MSVC and the Comeau online compiler versus g++?
Developers of g++ have added some overload functions - that's all...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|