Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2006-11-12 14:04:51


"Terry G" <tjgolubi_at_[hidden]> writes:

>>> 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"?

Oh, crud. We should have included a README file there, and I hope
Aleksey will help me get this sorted out so I can write one.

Here's what I think:

player1.cpp - this is exactly what's covered in the book; in fact, it
   was auto-extracted from the examples as shown in the book.

player2.cpp - this example demonstrates that the abstraction of the
   framework is complete by replacing its implementation with one that
   dispatches using O(1) table lookups, while still using the same
   code to describe the particular FSM. Look at this one if you want
   to see how to generate a static lookup table that's initialized at
   dynamic initialization time.

player.cpp, state_machine.hpp - this is something Aleksey wrote. I'm
   not sure, but I think it predates the book, and is more
   sophisticated in some ways but probably should be treated as an
   advanced example.

>>> 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.

Once you set up STLFilt, it just works, and it *really* eases the
pain.

> Are any of the Lints especially good with Boost/MPL?

Not that I know of.

>>> 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.

Many compilers still don't tell you everyplace you're supposed to use
it.

> I never think to use it proactively.

That'll come with time. It's not an MPL-specific thing, of course.
Anyone programming with templates will have to learn it eventually.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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