Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] [review][constrained_value] Review ofConstrainedValueLibrary begins today
From: Robert Kawulak (robert.kawulak_at_[hidden])
Date: 2008-12-10 19:02:34


        From: Jesse Perla

>>I think the best solution for dynamic constraints union (or
intersection) is to
>>use boost::signal, and this is how I would implement this. Again, this
is a
>>possible addition to the library in the future if it proves generally
needed.

>Yes, the signals approach would solve multiple constraint
bounds-checking through a predicate. But it doesn't solve my main use case:
Querying the sub-type information associated with a type for numeric algorithms,
which may not be connected intervals.

Oh, I see now. So instead of using boost::signal (which performs type erasure)
it'd be better to define a predicate containing a std::vector<within_bounds<...>
>. This way you could, by accessing this predicate, iterate over the intervals
and query the bounds.
        
>>On numeric_limits:
>>Then you may specialise those functions for constrained -- I think
it's a better
>>solution than providing numeric_limits for constrained in the library.

        
> I hear what you are saying. Yu can't write your own numeric_limits
classes/functions... they are very platform specific and are part of the
standard. Though there may be ways to subclass from your super-type.

The standard allows to specialise numeric_limits. So I suspect you could write
(somebody please correct me if I'm wrong):

        #include <limits>
        namespace std {
                template<typename V, typename C, typename E>
                class numeric_limits< constrained<V, C, E> > : public
numeric_limits<V> { };
        }
        
I don't know if it would be a good idea to include this in the library, but you
could definitely use this in your programs.
        
> I will get back in contact early January to see how I can help after
the review has died down.

Thanks! :-)
        
Best regards,
Robert


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