I've played around with this even more.  It compiles (as a .mm file) and runs perfect in a Mac OS X project, but it has issues with the rebind template when I try to compile the exact same file in an iPhone project.  However, I would think that if it is a C++ configuration issue then the iPhone project would have the same issue trying to compile the FSM in a .cpp file.

Any ideas?

On Thu, Jul 23, 2009 at 9:46 AM, Daniel Dilts <diltsman@gmail.com> wrote:


would really like the state
machine to be a member of an Objective C class.

This might work if you reference the state machine via pointer data member.

My code in the .mm file looks something like (with the FSM in a different .h file):

@interface delegateThingy {
    Machine * stateMachine;
@end

@implementation delegateThingy

- (void)init {
...
    stateMachine = new Machine();
    stateMachine->initiate();
...
}

@end

It fails to instantiate on the initiate call.  I vaguely remember something about forcing an entire template to be instantiated in a translation unit.  I guess I'll look it up in my reference manuals and see if that will help fix this problem.

I appreciate the help.