This function:
Code:
vector<string> split (const string& s) // function that splits a string and inserts the individual
{ // words into a vector<string>
vector<string> ret;
typedef string::size_type string_size;
string_size i = 0;
while (i != s.size())
{
while (i != s.size() && isspace(s[i])) // finds the first non-space char - will be at position i
i++;
string_size j = i;
while (j != s.size() && !isspace(s[j])) // finds the first space character after i - will be at position j
j++;
if (i != j) // if any words have been found
{
ret.push_back(s.substr(i, j-i)); // pushes back the word found between i and j
i = j;
}
}
return ret;
works fine under code-warrior, but i get the following warning when compiling with MSVC:
C:\Program Files\Microsoft Visual Studio\MyProjects\test\test.cpp(38) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std: :char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,st d::allocator<c
har> >,std::basic_string<char,std::char_traits<char>,st d::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,st d::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information
Why?