|
Boost : |
Subject: Re: [boost] [constrained_value] Constrained Value review results
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-10-29 08:56:50
----- Original Message -----
From: "Gordon Woodhull" <gordon_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, October 29, 2010 5:25 AM
Subject: Re: [boost] [constrained_value] Constrained Value review results
>
>
>
> On Oct 28, 2010, at 7:21 PM, Robert Kawulak <robert.kawulak_at_[hidden]> wrote:
>
>>> From: vicente.botet
>>> I was wondering whether the library could not define some more generic logical and comparison
>>> constraints so we can do
>>>
>>> constrained<int, and_<greater_equal<int_<-10> >, less_equal<int_<10> > > >
>>> constrained<int, and_<greater_equal<ratio<1,4> >, less_equal<ratio<1,2> > > >
>>> constrained<int, and_<greater_equal<int_<0> >, less_equal<big_prime > > >
>>> constrained<int, and_<greater<int_<0> >, less_equal<int_<10> > > >
>>
>> Similar thing, but based on lambdas, was already suggested by Gordon Woodhull and Stjepan Rajko was attempting to do this with
>> Boost.Phoenix. I don't know if this functionality is already included in that library. That's the discussion:
>>
>> http://groups.google.com/group/boostusers/browse_thread/thread/91e63d27da5bd151/ab9fce0cf54e59f4
>
> Heh heh. That was a fun idea: that in theory you could produce perfectly efficient predicates without boost::function, possibly even zero-size.
Yes, this is what I expect for these constraints efficiency and zero-size.
> Unfortunately Stjepan found that Phoenix was not designed to produce small enough functors to serve as good predicates for constrained. It would take a redesigned Phoenix or another library to do this sort of thing right.
I don't know what problems Phoenix has. Maybe we need to wait for a new library, but in the context of the Constraint library I find that all these predicates are no so hard to implement and will give a real power to the library.
Just my 2 cts.
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk