ошибка компиляции образца Spirit

Принятый ответ на this другой вопрос привел меня к this ] образец, но его компиляция дает длинный список ошибок. Вот пример кода, я добавил только include и фиктивный main ():

#include 
#include 
#include 
#include 
#include 

namespace qi = boost::spirit::qi;

template 
struct keys_and_values
  : qi::grammar()>
{
    keys_and_values()
      : keys_and_values::base_type(query)
    {
        query =  pair >> *((qi::lit(';') | '&') >> pair);
        pair  =  key >> -('=' >> value);
        key   =  qi::char_("a-zA-Z_") >> *qi::char_("a-zA-Z_0-9");
        value = +qi::char_("a-zA-Z_0-9");
    }
    qi::rule()> query;
    qi::rule()> pair;
    qi::rule key, value;
};

int main(int argc, char **argv)
{
    std::string input("key1=value1;key2;key3=value3");  // input to parse
    std::string::iterator begin = input.begin();
    std::string::iterator end = input.end();

    keys_and_values p;    // create instance of parser
    std::map m;        // map to receive results
    bool result = qi::parse(begin, end, p, m);   // returns true if successful
}

Я пробовал как boost 1.42 (по умолчанию в моем дистрибутиве Ubuntu 11.04), так и 1.48 (загруженный). Ошибки (я сообщаю об отфильтрованных QtCreator) различаются: версия 1.42 дает

/usr/include/boost/fusion/support/tag_of.hpp:92:13: error: no matching function for call to ‘assertion_failed(mpl_::failed************ boost::mpl::not_, std::basic_string > > >::************)’

/usr/include/boost/spirit/home/support/attributes.hpp:409: error: no matching function for call to ‘std::basic_string::basic_string(std::pair, std::basic_string >&)’

/usr/include/boost/spirit/home/support/attributes.hpp:409: error: no matching function for call to ‘std::basic_string::basic_string(mpl_::void_&)’

, в то время как вер. 1.48 дает

/home/carlo/Projects/spirit_vect_literals-build-desktop/../../cpp/boost_1_48_0/boost/spirit/home/qi/detail/assign_to.hpp:123: error: no matching function for call to ‘std::pair, std::basic_string >::pair(const std::basic_string&)’

Мне чего-то не хватает?

edit : Я нашел решение: добавьте этот заголовок, и обе версии скомпилируются

#include 

5
задан Community 23 May 2017 в 12:16
поделиться