given the following code
bool space(char c)
{
return isspace(c);
}
bool not_space(char c)
{
return !space(c);
}
template <class Out>
void split(const string& str, Out os){
typedef string::const_iterator iter;
iter i = str.begin();
while(i != str.end()){
i = find_if(i, str.end(), not_space);
iter j = find_if(i, str.end(), space);
if(i != str.end())
*os++ = string(i, j);
i = j;
}
}
when I put this into a separated source file and call "split" I get an error but when it's in the same source file as main I don't, any ideas why ?