Como posso usar atributos polimórficos com os analisadores boost :: spirit :: qi?

Gostaria que meu analisador boost :: spirit pudesse analisar um arquivo, converter as regras analisadas em tipos diferentes e emitir um vetor contendo todas as correspondências encontradas. Todos os tipos que são emitidos como atributos devem ser herdados de um tipo base, por exemplo:

#include <boost/spirit/include/qi.hpp>
#include <boost/fusion/adapt_struct.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/foreach.hpp>

struct CommandBase
{
   virtual void commandAction()
   {
     std::cout << "This is a base command. You should never see this!" << std::endl;
     //Boost::spirit seems to get mad if I make this purely virtual. Clearly I'm doing it wrong.
   }
};

struct CommandTypeA : public CommandBase
{
   int valueA;
   int valueB;
   virtual void commandAction()
   {
      std::cout << "CommandType A! ValueA: " << valueA << " ValueB: " << valueB << std::endl;
   }

};

struct CommandTypeB : public CommandBase
{
   double valueA;
   std::vector<char> valueB;
   virtual void commandAction()
   {
      std::cout << "CommandType B! valueA: " << valueA << " string: " << std::string(valueB.begin(), valueB.end()) << std::endl;
   }
};
struct CommandTypeC : public CommandBase
{
  //Represents a sort of "subroutine" type where multiple commands can be grouped together
  std::vector<char> labelName;
  std::vector<boost::shared_ptr<CommandBase> > commands;
  virtual void commandAction()
  {
      std::cout << "Subroutine: " << std::string(labelName.start(), labelName.end())
                << " has " << commands.size() << " commands:" << std::endl;
      BOOST_FOREACH(boost::shared_ptr<CommandBase> c, commands)
      {
           c->commandAction();
      }          
  }
};

Agora meutentada código do analisador:

namespace ascii = boost::spirit::ascii;
namespace qi = boost::spirit::qi;
using qi::lit_;

BOOST_FUSION_ADAPT_STRUCT(
   CommandTypeA,
   (int, valueA)
   (int, valueB)
)

BOOST_FUSION_ADAPT_STRUCT(
   CommandTypeB,
   (double, valueA)
   (std::vector<char>, valueB)
)

BOOST_FUSION_ADAPT_STRUCT(
   CommandTypeC,
   (std::vector<char>, labelName)
   (std::vector<boost::shared_ptr<CommandBase> >, commands)
)

template<typename Iterator, typename Skipper = ascii::space_type>
struct CommandParser : qi::grammar<Iterator, std::vector<boost::shared_ptr<CommandBase> >(), Skipper>
{
   public:
   CommandParser() : CommandParser()::base_type(commands)
   {
      CommandARule = qi::int_ >> qi::int_ >> lit("CMD_A");
      CommandBRule = qi::int_ >> +(qi::char_) >> lit("CMD_B");
      CommandCRule = qi::char_(':') >> lexeme[+(qi::char_ - ';' - ascii::space) >> +ascii::space] >> commands >> qi::char_(';');

      commands = +(CommandARule | CommandBRule | CommandCRule);
   }
   protected:
   qi::rule<Iterator, boost::shared_ptr<CommandTypeA>, Skipper> CommandARule;
   qi::rule<Iterator, boost::shared_ptr<CommandTypeB>, Skipper> CommandBRule;
   qi::rule<Iterator, boost::shared_ptr<CommandTypeC>, Skipper> CommandCRule;
   qi::rule<Iterator, std::vector<boost::shared_ptr<CommandBase> >, Skipper> commands;

};


std::vector<boost::shared_ptr<CommandBase> > commandList;
bool success = qi::phrase_parse(StartIterator, EndIterator, CommandParser, ascii::space, commandList);

BOOST_FOREACH(boost::shared_ptr<CommandBase> c, commandList)
{
    c->commandAction();
}

Agora, esse código definitivamente não será compilado, mas espero que ele entenda o que estou tentando fazer.

O principal problema é que o qi :: rules parece querer emitir a estrutura real, não uma referência a ela.

Minha pergunta é assim:

É possível forçar o qi :: rule a emitir uma referência compatível com polimorfismo, como estou tentando (se sim, como), e essa é a melhor abordagem para o que estou tentando realizar (ou seja, uma lista de objetos executáveis que representam os comandos analisados e seus parâmetros)?

questionAnswers(1)

yourAnswerToTheQuestion