Re: xutility iterator_category build errors



Carl R. Davies wrote:
Apologies for cross posting between m.p.vc.lang and m.p.vc.stl not sure which newsgroup is appropriate.

I'm using VS 2005 and have the following code:

#include <string>
#include <algorithm>
#include <iostream>

int main()
{
std::string url = "http:\\\\test.com\\index.htm";
std::string oldVal = "\\", newVal = "/";
std::string newUrl;

std::replace_copy( url.begin(),
url.end(),
newUrl,
oldVal,
newVal );

std::cout << newUrl << std::endl;

return EXIT_SUCCESS;
}


Which produces the following errors:
[snip]
> Thank you for your time.
> Carl.

Think I've fixed it:

#include <string>
#include <algorithm>
#include <iostream>

int main()
{
std::string url = "http:\\\\test.com\\index.htm";
std::string newUrl;

std::replace_copy( url.begin(),
url.end(),
back_inserter(newUrl),
'\\',
'/' );

std::cout << newUrl << std::endl;

return EXIT_SUCCESS;
}

Any other beginner bugs :) ?
.


Loading