|
Boost Users : |
Subject: [Boost-users] [proto] grammar to match operator in expression
From: Igor R (boost.lists_at_[hidden])
Date: 2016-05-16 12:44:32
Hi,
Why the following grammar doesn't match dereference, and what's the
correct way to do this?
Thanks!
//////////////////
#include <iostream>
#include <boost/proto/proto.hpp>
namespace proto = boost::proto;
using proto::_;
struct has_deref : proto::or_<
proto::dereference<_>,
proto::nary_expr<_, proto::vararg<has_deref>>
>
{};
template<class Expr>
void test_expr(const Expr &e)
{
proto::display_expr(e);
std::cout << "matches? " << std::boolalpha << proto::matches<Expr,
has_deref>::value << std::endl;
}
int main()
{
test_expr(proto::lit(1) + *proto::lit(2));
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net