Boost logo

Boost Users :

From: Terry G (tjgolubi_at_[hidden])
Date: 2006-11-07 23:42:45


>> BTW, on the boost website, there are three versions of the FSM player
>> example.
> Where?

Its in the Boost 1.33.1 download from the website, in
boost/libs/mpl/example/fsm.
I have the book CD too, of course. Which is "best"?

>> I write stuff that I think should work, but the compiler issues tons of
>> error messages.
> Did you read the chapter on diagnostics and apply the advice therein?

Read, yes. Apply, mostly no. I use my text editor to process the verbiage,
and I use two compilers.
I've been reluctant to learn another tool, i.e. the filters.
Are any of the Lints especially good with Boost/MPL?

>> Pitfalls like when to use typename.
> Did you read the appendix on the typename and template keywords?

Read, yes. Understand, sort of. I can kind of tell when I've omitted the
typename keyword, because that's what the compilers usually tell me. I
never think to use it proactively. The special use of the template keyword,
I may have needed once.

> The FSM example shows the basic technique for "generating a switch"
> with TMP... although in this particular case you *might* have been
> better off using the preprocessor library (also covered in the book).

Yeah, sort of tried BOOST_PP too, but it konks out around 130 cases, saying
something about reaching compiler nesting limits (VC8). It was just plain
fun to play with the sequences. I used BOOST_PP_... SEQ_ENUM, SEQ_HEAD,
SEQ_FOR_EACH, and STRINGIZE. It took an entire day to get this to work
because I tinkered around a lot. I ended up just using a simple macro to
generate each case in 15 minutes.

BTW, using the DerefTag<TAG> technique from my previous post did net me a
tiny advantage. Since I know all the message tags right now, from a spec, I
can create the message printer right now, with a case for each message tag.
Since the DerefTag<>::type defaults to the Message base class until its
explicitly specialized, my printer will display a human readable tagname and
then a hex dump for each unimplemented message. Then when I get around to
actually implementing each derived Message, my printer code doesn't need to
change at all. I just add the appropriate DerefTag specialization and an
ostream<< operator, right next to the derived message class, and the entire
message magically appears in human readable format. Cool. I didn't see
that one coming!

> I feel your pain.

Thanks. I needed that.

My son is 6 years old. He wants things his way, right now, no
complications.
He is just learning to really read rather than just skimming and looking at
the pictures.
He reads the same books over and over.
He still has a lot to learn.

terry


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net