Boost logo

Boost :

From: Phil Bouchard (philippe_at_[hidden])
Date: 2008-06-08 18:37:23


> "Hervé Brönnimann" <hervebronnimann_at_[hidden]> wrote in message
> news:AA37BF5C-9007-45AC-92DC-4790A699F610_at_mac.com...
> I am not following this thread but when I hear of things like
> boost::numeric::interval<void *>, I have to wonder: what is it you
> are trying to do? Interval is a *numeric* type, intended for
> *computation* (i.e., operator+,-,*,/). It is not really intended for
> integral types, and certainly not for pointer types. If you want an

[...]

I think it's more of a usability issue here because "interval" is a very
generic term and we all know what it is supposed to do without reading its
introduction. If the required changes become too much of an issue then
let's forget about it but up to now the only required change would be to
substitute a static_cast<>() of a constant integer to a constructor followed
by an addition:

Problem:
.../include/boost/numeric/interval/checking.hpp:62: error: invalid
static_cast from type `int' to type `void*'

  static T empty_lower()
  {
    return (std::numeric_limits<T>::has_quiet_NaN ?
            std::numeric_limits<T>::quiet_NaN() : static_cast<T>(1));
  }

Solution:
  static T empty_lower()
  {
    return (std::numeric_limits<T>::has_quiet_NaN ?
            std::numeric_limits<T>::quiet_NaN() : T(0) + 1);
  }

I was hoping using interval<void *> to trace what block of memory the
construction of an object is being made on but it can easily be used to
unify a block of memory with a pool or memory segment for example.

Thanks,
-Phil


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