2014-01-29 1 views
1

У меня есть следующая грамматика:Проблемы повышения дух осуждается

#include <boost/spirit.hpp> 

struct point_grammar 
: public boost::spirit::grammar<point_grammar> 
{ 
    template <typename Scanner> 
    struct definition 
    { 
     boost::spirit::rule<Scanner> E, S, V; 

     definition(const point_grammar &self) 
     { 
     using namespace boost::spirit; 
     E = S >> V; 
     S = '@' >> +(~ch_p('@') - V); 
     V = str_p("[email protected]") | str_p("[email protected]"); 
     } 

     const boost::spirit::rule<Scanner> &start() 
        { 
     return E; 
        } 
    }; 
}; 

Когда я компилирую, компилятор показать мне следующее предупреждение:

/usr/include/boost/spirit.hpp:18:4: warning: "This header is deprecated. Please use: boost/spirit/include/classic.hpp"

Но при изменении #include для подъема/духа /include/classic.hpp, у меня есть следующая ошибка:

(expected template-name before ‘<’ token) in the line where is: : public boost::spirit::grammar.

Что я могу сделать?

ответ

5

Вы: : Обновление до Spirit V2. Я действительно показал вам, как это сделать в «Problems with grammar» :)
Серьезно. Boost 1_36 был выпущен 14 августа 2008 года.

Теперь, документы (http://boost-spirit.com/home/doc/) объясняют

To avoid namespace conflicts with the new Spirit V2 library we moved Spirit Classic into the namespace boost::spirit::classic . All references to the former namespace boost::spirit need to be adjusted as soon as the header names are corrected as described above. As an alternative you can define the preprocessor constant BOOST_SPIRIT_USE_OLD_NAMESPACE , which will force the Spirit Classic code to be in the namespace boost::spirit as before. This is not recommended, though, as it may result in naming clashes.

(источник страницы: http://www.boost.org/doc/libs/1_55_0/libs/spirit/doc/html/spirit/what_s_new.html под "Классик")

Таким образом, вы могли продолжать использовать тот же код, если вы обновите ссылки пространства имен.