Boost logo

Boost :

Subject: Re: [boost] [Proto] Computing type in expression
From: joel falcou (joel.falcou_at_[hidden])
Date: 2010-06-15 09:42:39

Eric Niebler wrote:
> Don't feel stupid; there are contexts in which you actually *can* use
> wrap in type computations within wrap itself, so it's easy to get confused.
> template<class Expr>
> struct wrap
> : proto::extends<Expr, wrap<Expr> >
> {
> template<struct Sig>
> struct result
> {
> typedef typename some_fun<wrap>::type type; //OK!
> };
> };
I ended with that anyway as the result_type of a NT² expression depends
on how you access them
as we support floating point indexing that perform linear interpolation,
ranges and more. So in the
end , the geenral value_type was a bad idea whiel result_of compliance
was OK.

> The difference is that by the time result gets instantiated somewhere
> else in your program, wrap will be complete. This will work fine until
> you try to instantiate result from within wrap itself (e.g. to compute
> the return type of a nullary operator() overload). Then it blows up with
> very mysterious errors. It's tricky
I saw that :€

Boost list run by bdawes at, gregod at, cpdaniel at, john at