Re: [Qi] Bizarro Qi results coming from compiler
Michael Powell <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAMEoF_E-KovYwJfknshhnqgKEWQx91rt8ZyV8WGnktvduwDpgg@mail.gmail.com> |
On Wed, Nov 29, 2017 at 2:49 PM, Seth <[email protected]> wrote: > On 29-11-17 19:31, Michael Powell wrote: >> Particularly the idiotic comments concerning: > > Let's try to stay civilized. These are the people trying to help you. I > can see you're frustrated, but let's not detract from the people trying > to help? Thank you. Well, it **is** frustrating when I am doing precisely what the comment suggests I should be doing, idiotic or not. > Also, it holds water just fine (of course). You declared the accepted > skipper as typename Skipper = my_skipper<Iterator>. And yet you pass in > `boost::spirit::qi::ascii::space`. That's of type > `boost::spirit::qi::ascii::space_type`. Not the same type. Excuse me? space *is* of type space_type. boost::spirit::qi::ascii::space is just an alias to boost::spirit::ascii::space, which is of type boost::spirit::ascii::space_type. Or is my IntelliSense lying to me? That being established, I should be able to specify the skipper, just besides the *default* template argument, no? Why would that be a problem? Let's reason it through, shall we? i.e. template<typename Iterator, typename Skipper = qi::ascii::space_type> struct my_grammar : qi::grammar<Iterator, ..., Skipper> { // ... }; All this means is that Skipper has a *default* type specification when the end user did not specify one: i.e. my_grammar<std::string:const_iterator /* with default skipper type */ > g; So, why is that a problem for: const auto& parse_ = [&g](std::string const& s) { auto it = s.begin(); auto const parsed = qi::phrase_parse(it, s.end(), g, qi::ascii::space); // ??? in effect, the same as saying: qi::phrase_parse(it, s.end(), g, decltype(g)::skipper_type()); REQUIRE(parsed); REQUIRE(it == s.end()); }; That is, unless there is something else about <space> that isn't the same, but I can't imagine what that is? > Try passing in the required skipper type: > http://coliru.stacked-crooked.com/a/78e51182445391c6 > > > Cheers, Seth > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot