Re: Custom containers with Spirit X3 (QString)
Tim Angus <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
Thanks for your help. Your sample does work for me, but unfortunately
when I try to use a more complex grammar, it breaks down:
//using T = boost::variant<double, std::string>; // Works fine...
using T = boost::variant<double, QString>; // ...not so much
namespace x3 = boost::spirit::x3;
const x3::rule<class Test, T> test = "Test";
const auto test_def = x3::double_ | (*x3::alnum);
BOOST_SPIRIT_DEFINE(test);
int main()
{
const std::string text("foo");
auto begin = text.begin();
const auto end = text.end();
T result;
const auto ok = x3::phrase_parse(begin, end, test, x3::space, result);
return (ok && begin == end);
}
The specific error is:
.../move_to.hpp:115: error: no match for 'operator=' (operand types are
'boost::variant<double, QString>' and
'std::remove_reference<std::__cxx11::basic_string<char>&>::type {aka
std::__cxx11::basic_string<char>}')
dest = std::move(src);
^
...which is unsurprising really since the types are:
Source = std::__cxx11::basic_string<char>&
Dest = boost::variant<double, QString>
I'm not sure how to proceed. I did think to try and change the /input/
type to a QString, but this falls down because spirit doesn't know how
to deal with QString's iterator value type QChar. Any ideas?
On 16/11/16 18:54, Mike Gresens wrote:
> Hi,
>
> does the following sample code help?
>
> Best regards,
> Mike...
>
>
>
>
>
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/Custom-containers-with-Spirit-X3-QString-tp4689943p4689955.html
> Sent from the spirit-general mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Spirit-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/spirit-general
>
------------------------------------------------------------------------------
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general