C++ Mystery: [Fwd: Re: [Boost-users] [statechart] Template States, Compile Error]

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

C++ Mystery: [Fwd: Re: [Boost-users] [statechart] Template States, Compile Error]

greened
Since both I and Andreas are baffled by this problem, I thought I'd
forward this on to the larger Boost community.  Anyone have any
ideas about it?  It seems like it should be a simple thing but
something about the way lookup works in C++ is causing the
inner_context_type member of simple_state to be missed.  The
problem persists even if

typedef typename sc::simple_state< NormalMode< Type >, Switch,
                                   Off<Type> >::inner_context_type
        inner_context_type;

is added to the NormalMode class template.

                             -Dave

It is getting late here in Switzerland. I've tried several things,
nothing worked and I don't have much of a clue at the moment. The fact
that two independent compilers choke on this pretty much rules out a
compiler bug. I think a library bug isn't likely either as everything
works when you make the innermost state non-templated. Moreover, the
newest version of TransitionTest.cpp (checked in yesterday) seems to
work perfectly on a number of platforms. That test does something very
similar to what you try to do. I can't currently see any other
explanation than that we must both be missing something. The attached
program is what I got after throwing out all the unnecessary stuff. It
compiles on MSVC, but as soon as you uncomment the commented parts it
complains with "'inner_context_type' : is not a member of
'NormalMode<Type>'". Tomorrow I'll try to reduce it to something that
hasn't anything to do with Boost.Statechart...

#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/simple_state.hpp>

namespace sc = boost::statechart;
namespace mpl = boost::mpl;

template< typename Type > struct NormalMode;
struct Switch : sc::state_machine< Switch, NormalMode< int > > {};

/*template< typename Type >*/ struct Off;
template< typename Type >
struct NormalMode : sc::simple_state< NormalMode< Type >, Switch, Off/*<
Type >*/ >
{
};

//template< typename Type >
struct Off : sc::simple_state< Off/*< Type >*/, NormalMode< int > >
{
};

int main()
{
  Switch machine;
  machine.initiate();
  return 0;
}

--
Andreas Huber

When replying by private email, please remove the words spam and trap
from the address shown in the header.


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: C++ Mystery: [Fwd: Re: [Boost-users] [statechart] Template States, Compile Error]

Andreas Huber-2
The reason for the mystery & a solution is described here:
<http://article.gmane.org/gmane.comp.lib.boost.user/17091>

--
Andreas Huber

When replying by private email, please remove the words spam and trap
from the address shown in the header.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost