I wanted to confirm if this is a bug in visual studio 2010. If yes then can any settings be changed? or how do I solve this?
#include <iostream>
#include <vector>
#include <algorithm>
std::vector<std::string> test;
test.push_back("hello"); test.push_back("ABC");
std::sort(test.begin(), test.end());
Well this happened because I did not include the std::string header .
My first guess would be that you forgot to include a header (probably
<string>). You can end up with some minimal forward declaration (or something like that) from a different header that lets part of the code compile, but other parts break in strange ways leading to misleading error messages.In a quick test, this compiles with VS 2008 through 2012: