BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Boost tokenizer in component

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
CN
Guest





PostPosted: Mon Jan 22, 2007 9:13 pm    Post subject: Boost tokenizer in component Reply with quote



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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.