John
John

Reputation: 133

boost::spirit 1.53 multi_pass iterator related compilation error

The code:

typedef std::string::const_iterator iterator;
namespace parsers
{
    namespace spirit = ::boost::spirit;
    namespace ascii = ::boost::spirit::ascii;
    namespace phoenix = ::boost::phoenix;
    spirit::qi::rule< iterator, void(std::string), ascii::space_type > action_parser = 
        '"'
        > spirit::qi::lit("action")
        > spirit::qi::labels::_r1
        > '"';
}

Errors:

> 1>CL : warning : This header is deprecated. Please use:
> boost/spirit/include/classic.hpp
> 1>D:\CPP\boost\boost_1_53_0\boost_1_53_0\boost/spirit/home/support/iterators/multi_pass_fwd.hpp(59):
> error C2976: 'boost::spirit::multi_pass' : too few template arguments
> 1>D:\CPP\boost\boost_1_53_0\boost_1_53_0\boost/spirit/home/support/iterators/multi_pass_fwd.hpp(86):
> error C3203: 'multi_pass' : unspecialized class template can't be used
> as a template argument for template parameter 'Iterator', expected a
> real type
> 1>D:\CPP\boost\boost_1_53_0\boost_1_53_0\boost/spirit/home/support/iterators/multi_pass_fwd.hpp(86):
> error C2955: 'boost::spirit::multi_pass' : use of class template
> requires template argument list
> 1>D:\CPP\boost\boost_1_53_0\boost_1_53_0\boost/spirit/home/support/iterators/multi_pass_fwd.hpp(86):
> error C2977: 'boost::spirit::traits::is_multi_pass' : too many
> template arguments
> 1>D:\CPP\boost\boost_1_53_0\boost_1_53_0\boost/spirit/home/support/iterators/multi_pass.hpp(183):
> error C2976: 'boost::spirit::multi_pass' : too few template arguments
> 1>D:\CPP\boost\boost_1_53_0\boost_1_53_0\boost/spirit/home/support/iterators/istream_iterator.hpp(37):
> error C2955: 'boost::spirit::multi_pass' : use of class template
> requires template argument list

Upvotes: 4

Views: 556

Answers (2)

John
John

Reputation: 133

I removed the boost/spirit.hpp inclusion. Why was it the reason?

Courtesy FoReVer

Upvotes: 0

sehe
sehe

Reputation: 392979

Q.: I removed the boost/spirit.hpp inclusion. Why was it the reason? P.S. Thx to FoReVer

A.: It was the reason because

CL : warning : This header is deprecated. Please use:
> boost/spirit/include/classic.hpp

In other words: it told you exactly why. And this translates into normal life as "just because".

Now onto why the developers would deprecate old headers:

Wikipedia Deprecation

Deprecation is a status applied to a computer software feature, characteristic, or practice indicating it should be avoided, typically because of being superseded

And there you have it: "typically because of being superseded". In this case, SpiritV2 superseded SpiritV1 around 2009 (?). This is what the documentation says about it:

Spirit Classic

The Spirit V1.8.x code base has been integrated with Spirit V2. It is now called Spirit.Classic. Since the directory structure has changed (the Spirit Classic headers are now moved to the $BOOST_ROOT/boost/spirit/home/classic directory), we created forwarding headers allowing existing applications to compile without any change.

However, these forwarding headers are deprecated, which will result in corresponding warnings generated for each of the headers starting with Boost V1.38. The forwarding headers are expected to be removed in the future.

The recommended way of using Spirit Classic now is to include header files from the directory $BOOST_ROOT/boost/spirit/include. All Spirit Classic headers in this directory have 'classic_' prefixed to their name.

All in all, it just means: Spirit Classic is OLD. Don't use it.

In case you have inherited a Spirit V1 parser and need guidance on migrating to Spirit V2:

Note: SpiritX3 is already under development as we speak. See here

Upvotes: 2

Related Questions