Boost logo

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


Why the following grammar doesn't match dereference, and what's the
correct way to do this?


#include <iostream>
#include <boost/proto/proto.hpp>

namespace proto = boost::proto;
using proto::_;

struct has_deref : proto::or_<
    proto::nary_expr<_, proto::vararg<has_deref>>

template<class Expr>
void test_expr(const 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, kalb at, bjorn.karlsson at, gregod at, wekempf at