Board index » cppbuilder » Boost tokenizer in component
CN
![]() CBuilder Developer |
Boost tokenizer in component2007-01-22 11:13:26 PM cppbuilder1 Hi! I am not sure this is the right place to ask. I have been spending almost a week dealing with this hair tearing issue! With BCB 6, I re-wrote the following function from library project (.bpf) to component project (.bpl). This compoent is then dragged-and-dropped to a form which is part of a .exe project. Before the rewrite, everything works fine. In order to isolate the problem, I also created a new single-file project consisting of this function and found this function behaves as expected. After re-writing it to component, I have experienced AV, FFEEACE, Abnormally Terminated, IDE crash, etc., at various spots inside of this function as illustrated by the comments in the code. AV and FFEEACE happen most with "Release All" compiler switch being set. Abnormally Terminated happens when "Full Debug" is set and F8 is hit in IDE to step to Tokens.begin(). IDE crashes when the component, whose constructor calls this function, is drop to a form. Boost source files seems to comprise everything in .hpp files (no .cpp files). IDE does not open the related Boost source file when I step through LastToken(). Hence I can't locate the source with problem. By the way, I have got a lot of this warning: W8059 Structure packing size has changed I am completely lost and actually do not have any idea what are the approrpriate questions I should ask here for help! Perhaps these two are meaningless enough: 1. Can it be BCB's problem when a compoent consists of certain libraries? 2. How to force IDE to open the Boost .hpp source files for debug when I step through this function source code? The expected results are as follows: LastToken("aa:bb",":"); //bb LastToken("aa;bb;cc",";"); //cc #include "boost/tokenizer.hpp" AnsiString LastToken(AnsiString TheSource,char *delimiters) { if(TheSource.Length() == 0) return ""; typedef boost::tokenizer<boost::char_separator<char>>Tok; std::string s=std::string(TheSource.c_str(),TheSource.Length()); boost::char_separator<char>sep(delimiters); Tok Tokens(s,sep); Tok::iterator ThisItr,NextItr; NextItr=Tokens.begin(); //Abnormal termination //ThisItr=NextItr; ThisItr=Tokens.begin(); //AV fprintf(fp,(*ThisItr).c_str()); //nothing is printed for(++NextItr;NextItr != Tokens.end();++NextItr){ ThisItr=NextItr; } return AnsiString((*ThisItr).c_str(),(*ThisItr).size()); } Regards, CN |