Boost logo

Boost :

Subject: Re: [boost] [constrained_value] Constrained Value review results
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2010-10-28 23:25:28


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.

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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk