Boost logo

Boost :

From: Matthew Henderson (M.J.Henderson_at_[hidden])
Date: 2006-01-25 06:26:11


Pavol,

Here is an example of what we observed. This
program compiles and runs without error. The point
here is that, if the behaviour is as described
in the documentation, then we would expect the last
assert to fail, but is succeeds.

#include <vector>
#include <string>
#include <iostream>
#include <cassert>
#include <boost/algorithm/string.hpp>

int main() {
  std::string test_string("a,b,c,d,e");
  std::vector<std::string> test_vector;
  test_vector.push_back("X");
  assert( test_vector.size() == 1 );
  boost::algorithm::split(test_vector,test_string,boost::algorithm::is_any_of(","));
  assert( test_vector.size() == 5 );
}

regards,
Matthew Henderson

 On Tue, Jan 17, 2006 at 12:04:09PM +0000, Matthew Henderson wrote:
> There are two minor problems with the documentation which I have noticed.
>
> 1. Undocumented headers.
> boost/algorithm/string/config.hpp
> boost/algorithm/string/iter_find.hpp
>
> 2. The statement "Each part is copied and added as a new element to the output
> container." which appears both in the documentation of boost/algorithm/string
> /split.hpp and in comments of that header file is not an accurate description
> of what actually happens. Some testing by myself suggests that, in fact, the
> contents of the original container are overwritten.
>
 
This is definitely not what the split is supposed to do. Could you please
 send some examples proving your claim. Algorithms in split.hpp does not contain
 any mutating code that I'm aware of.
 
Regards,
 
Pavol


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk