-
About std::remove
I am using the Borland c++ compiler 5.6 .
This problem is about remove algorithm in STL and remove file function in
<cstdio> .
This is a code can work.
-----------------------------------------
#include <algorithm>
using namespace std;
...
remove(XX.begin(), XX.end(), xxValue);
...
-----------------------------------------
OK.
But this does not work.
----------------------------------------
#include <algorithm>
...
std::remove(XX.begin(), XX.end(), xxValue);
...
----------------------------------------
Can not compile it because the compiler think the "std::remove" is the
"remove(const char *)" in <cstdio>.
-
Re: About std::remove
About std::remove wrote:
>
> I am using the Borland c++ compiler 5.6 .
> This problem is about remove algorithm in STL and remove file function in
> <cstdio> .
>
> This is a code can work.
> -----------------------------------------
> #include <algorithm>
> using namespace std;
> ..
>
> remove(XX.begin(), XX.end(), xxValue);
>
> ..
> -----------------------------------------
> OK.
>
> But this does not work.
> ----------------------------------------
> #include <algorithm>
> ..
>
> std::remove(XX.begin(), XX.end(), xxValue);
>
> ..
> ----------------------------------------
> Can not compile it because the compiler think the "std::remove" is the
> "remove(const char *)" in <cstdio>.
Strange. The prototypes of the two remove() function are very different.
Can you compile the following program?
#include <algorithm>
#include <cstdio>
#include <string>
int main()
{
std::string XX="hello";
std::remove(XX.begin(), XX.end(), 'h'); //STL's remove
std::remove("hello.tmp"); //C remove
}
It compiles and runs without any problem with C++ Builder 4.0. If your
compiler refuses to compile it, you should probably try a different
compiler instead.
Danny
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks