
Hi, Please see to documentation for the split() http://www.boost.org/doc/html/id2580251.html There is explicit notice: "Notes: Prior content of the result will be overwritten." So I think, that the documentation is correct. Best regards, Pavol On Wed, Jan 25, 2006 at 11:26:11AM +0000, Matthew Henderson wrote:
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 _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost