-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X3: Use traits to test if container is empty #355
Conversation
Do you specialize |
Ah right, I'll admit I was testing using 1.66 rather than the develop branch; it looks like ee4943d would resolve my problem albeit in a different way. FWIW, my custom container is QString, and my traits are: namespace boost { namespace spirit { namespace x3 { namespace traits {
template<>
struct push_back_container<QString>
{
template<typename T>
static bool call(QString& c, T&& val)
{
c.push_back(std::move(val));
return true;
}
};
template<>
struct append_container<QString>
{
template<typename Iterator>
static bool call(QString& c, Iterator first, Iterator last)
{
c.append(first, std::distance(first, last));
return true;
}
};
template<>
struct is_empty_container<QString>
{
static bool call(QString const& c)
{
return c.isEmpty();
}
};
}}}} |
Yeah. I have asked the first question just to be sure you are using a custom container and we are not fixing some hidden problem with the patch. |
Ah right, cool. Thanks. |
👍 |
Thanks for patch, and for Tremulous! |
Haha, you're welcome! Believe it or not a small number of people still play it. |
Nice to hear this! I had not played it since 2011 because of server population drop (it was hard to gather together even 2x2). |
::empty() is called on the Attribute in parse_into_container_impl. If Attribute has no ::empty(), if fails to compile. Probably instead it should use traits::is_empty(...).