Re: Boost Spirit and VS2017
Dan Bloomquist <[email protected]> Wed, 31 Oct 2018 09:14:37 -0700
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
Michael Powell wrote:
> Hello,
>
> I am receiving the following error building against the latest VS2017 ...
>
> 1>Version_Parser.cpp
> 1>d:\dev\boost.org\boost_1_68_0\boost\iostreams\positioning.hpp(96):
> error C4996: 'std::fpos<_Mbstatet>::seekpos': warning STL4019: The
> member std::fpos::seekpos() is non-Standard....
building with v141, not the latest and
_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
I get no errors or warnings. on the other hand, I think you want your
parser to look like:
_major_part >> _minor_part >> -_patch_part >> -_build_par
At that, if using v141, why not just use x3? It is so much easier on the
eyes.
Best, Dan.
.....................................................................................
using namespace boost::spirit::x3;
struct version
{
short _major= 0;
short _minor= 0;
short _patch= 0;
short _build= 0;
};
BOOST_FUSION_ADAPT_STRUCT(version, _major, _minor, _patch, _build);
auto const part = rule<struct _, short>("part") = int_ >> -lit(".");
auto const ver = rule<struct ver_def, version>("ver") = part >> part >>
-part >> -part;
void test(const char* in)
{
std::string str(in);
version vers;
auto begin = str.begin();
phrase_parse(begin, end(str), ver, space, vers);
std::cout << "end: " << begin
<< "* " << vers._major
<< " " << vers._minor
<< " " << vers._patch
<< " " << vers._build
<< std::endl;
}
int main()
{
test("1. 2.3. 4");
test("1 . 2");
return 0;
}
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general