Advertisement
Guest User

Untitled

a guest
Apr 1st, 2011
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. template<typename C>
  2. void test_custom(string const& s, C& ret) {
  3.   C output;
  4.  
  5.   typedef string::const_iterator iter;
  6.   iter beg;
  7.   bool in_token = false;
  8.   for( string::const_iterator it = s.begin(), end = s.end();
  9.     it != end; ++it )
  10.   {
  11.     void* t = strpbrk(&*it, "[],-'/\\!\"§$%&=()<>?");
  12.     if ( t != NULL )
  13.     {
  14.       if( in_token )
  15.       {
  16.         output.push_back(typename C::value_type(beg, it));
  17.         in_token = false;
  18.       }
  19.     }
  20.     else if( !in_token )
  21.     {
  22.       beg = it;
  23.       in_token = true;
  24.     }
  25.   }
  26.   if( in_token )
  27.     output.push_back(typename C::value_type(beg, s.end()));
  28.   ret.swap(output);
  29. }
  30.  
  31. // in this state only parts of the strings are spliced up. What can I do to fix it?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement