Hi all,
i wnat to extend the example in the file mixed.cpp with an operator[]:
double operator []( std::ptrdiff_t i ) const
{
DereferenceCtx const deref = {};
AdvanceCtx adctx(i); //just shift the iterator with std::advance
typename boost::result_of::type expr2 =
Begin()(*this);
proto::eval(expr2,adctx);
return proto::eval(expr2, deref);
}
This works well.
However is it possible to let proto figure out what the result_type of
this function is?
I've tried to program in this way.
typedef typename boost::result_of::type Expr2;
typedef typename proto::result_of::eval::type
result_type;
result_type operator []( std::ptrdiff_t i ) const
{
DereferenceCtx const deref = {};
AdvanceCtx adctx(i);
Expr2 expr2 = Begin()(*this);
proto::eval(expr2,adctx);
return proto::eval(expr2, deref);
}
But the compiler complained that the nested struct eval in the struct
struct DereferenceCtx
{
template
struct eval
: proto::default_eval
{};
cannot be instantiated by this particulat template. So I guess I ' ve to
write a grammar for this issue. Is this true?