|
Boost Users : |
Subject: Re: [Boost-users] [Proto] Recreating an expression
From: Eric Niebler (eric_at_[hidden])
Date: 2009-07-03 13:09:07
christophe henry wrote:
> Thanks Eric for your fast answer!
> Unfortunately, this doesn't solve my problem. To make a very very long
> discussion long, here a small
> example showing the problem from another side:
> I have an expression wrapper called mp_terminal and I define terminals,
> but not in the documented
> way (which I suspect is the problem)
Indeed.
> but instead deriving from them (for
> convenience purposes), for example:
> struct True : mp_terminal<typename proto::terminal<guard_tag>::type>
> {...}
<snip>
> Then, why do most use cases work like a charm? Only unary operators seem
> to fail.
It's because (a) True is a Proto type, but hasn't been made so by
directly using proto::extends, and (b) Proto's unary operators are being
a little too nit-picky about (a).
I have fixed (b) on trunk (changelist 54610). In the mean time, you can
change your definition of True and False to use this formulation:
struct True
: proto::extends<
mp_terminal<typename proto::terminal<guard_tag>::type>
, True
, sm_domain
>
or the simpler and more direct
struct True
: proto::extends<
typename proto::terminal<guard_tag>::type
, True
, sm_domain
>
HTH,
-- Eric Niebler BoostPro Computing http://www.boostpro.com
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