Принятый ответ на this другой вопрос привел меня к this ] образец, но его компиляция дает длинный список ошибок. Вот пример кода, я добавил только include и фиктивный main ():
#include
#include
#include
Я пробовал как 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