Boost logo

Boost :

From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2008-06-06 18:05:22

Phil Bouchard wrote:
>error: invalid static_cast from type `int' to type `void*'

This is line 62 of checking.hpp:

std::numeric_limits<T>::quiet_NaN() : static_cast<T>(1));

It looks like we are casting a constant integer to void*, which it
doesn't like. Obviously we could force the compiler to eat the line by
changing static_cast to reinterpret_cast, but that isn't good.

Instead of casting to an integer constant, we could construct a T from
the integer constant:

std::numeric_limits<T>::quiet_NaN() : T(1));

, which seems like a reasonable thing to do. I don't know why they use
static_cast instead, but there must have been a reason. It looks like
there are numerous places in interval that need to be modified where
constants are being static_cast to T that prevent it from compiling for
intervals of pointer type. I think intervals of pointer type make a lot
of sense. In fact, it moves us in the direction of intervals of random
access iterators, which is sort of intriguing. I guess its up to you to
make the case for a code change in interval to accommodate your use


Boost list run by bdawes at, gregod at, cpdaniel at, john at