Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2000-07-31 09:11:17

> is_convertible<T,U>::value
> true if T is convertible to U, based upon the code in
> in the vault. I've also copied the copyright notice from
> that file over into type_traits.hpp - Jeremy is this OK with you?

A welcome addition!

> is_empty<T>::value
> updated to use is_convertible<T,int>::value to screen out enum's;
> this change filters through to compressed_pair which can now
> be used with enum types.

This also screens out any empty UDTs that are convertible to int -- a
ridiculous situation, but it should be doc'ed, IMO.

> alignment_of<T>::value
> The alignment of some arbitary type T; last time I tried this
> Cleary shot me down in flames (rightly as it wasn't portable), hopefully
> this version is OK!

Sorry! I'll try to be gentle this time: it's still not guaranteed to work.
;) However, I think it is good enough -- it would work for all "normal"
compilers (all I know of).

> This is guarenteed to produce a multiple of the actual alignment of the
> type - if the compiler does not add gratuitous amounts of padding to it's
> struct's then it will return exactly the alignment value (and so far all
> the compiler that I have tested do so).

The compiler can also add padding to the end of its struct, although in your
implementation I cannot imagine a compiler wanting to do so (since T is
already padded).


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