template void test_custom(string const& s, C& ret) { C output; typedef string::const_iterator iter; iter beg; bool in_token = false; for( string::const_iterator it = s.begin(), end = s.end(); it != end; ++it ) { void* t = strpbrk(&*it, "[],-'/\\!\"ยง$%&=()<>?"); if ( t != NULL ) { if( in_token ) { output.push_back(typename C::value_type(beg, it)); in_token = false; } } else if( !in_token ) { beg = it; in_token = true; } } if( in_token ) output.push_back(typename C::value_type(beg, s.end())); ret.swap(output); } // in this state only parts of the strings are spliced up. What can I do to fix it?