|
Boost : |
From: Andreas Huber (spam2002_at_[hidden])
Date: 2003-02-05 07:09:28
Aleksey,
> It might be possible to fix it, but it will require some work. Let
> me know if it's important for you, and I'll move it up in my TODO list.
Well, it is not that important since mpl::is_sequence<> is only used to
provide some syntactic sugar. I could just as well tell my users that they
always have to specify an mpl::list containing a single type instead of a
type under MSVC...
Thanks,
Andreas
P.S. While making my first serious steps with mpl yesterday, I ran into some
weird errors while trying to compile the following with MSVC 7.0. Could this
also be a limitation of my platform? Am I using some functions that are a
problem for MSVC, or am I just missing something?
#include <boost/mpl/placeholder.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/list.hpp>
#include <boost/mpl/transform.hpp>
template< class Event >
class event_handler
{
protected:
event_handler() {}
~event_handler() {}
private:
virtual bool handle_event( const Event & theEvent ) = 0;
};
template< class Derived, class Event, class Destination >
class transition_handler : public event_handler< Event >
{
private:
virtual bool handle_event( const Event & ) { /* */ }
};
template< class Event, class Destination >
struct transition
{
template< class Derived >
struct apply
{
typedef transition_handler< Derived, Event, Destination > type;
};
};
class Paused {};
class Running {};
class EvPause {};
// Since I can write this:
typedef boost::mpl::apply< transition< EvPause, Paused >, Running >::type
handler1;
// I should be able to write the following, or am I missing something?
// Does not compile under MSVC7.0
using namespace boost::mpl::placeholder;
typedef boost::mpl::list< transition< EvPause, Paused > > trans_list;
typedef boost::mpl::transform<
trans_list, boost::mpl::apply< _, Running > >::type handler_list;
typedef boost::mpl::front< handler_list >::type handler2;
int main()
{
// this is just to see the type in the debugger
handler1 * pHandler1 = 0;
pHandler1;
handler2 * pHandler2 = 0;
pHandler2;
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk