Template function splitting a container according to a predicate. This function takes a container (e.g. a string), a predicate (see std::find_if), and appends to the list of containers the ones that result from splitting the first container.

Being based on the same algorithm as Split, this function does not include the instances found to be "delimiters".

toSplit container to be split.
predicate predicate used to differentiate slices.
result list of containers to which will be appended the results of the split.
	const std::string test( "This is a test." ) ;
	const char d = ' ' ;

	typedef std::list<std::string> List ;
	List result ;

	Split( test, d, result ) ;

	int n = 0 ;
	for( List::iterator i = result.begin(); i != result.end(); ++i, ++n )
		std::cout << "item " << n << ": >" << *i << "<" << std::endl ;


See also:


Marc Petit.

Generated on Thu Jun 4 20:39:15 2009 for Ceylan by  doxygen 1.5.8