Hi everybody, the attached files contain a bunch of trivial stuff related to integral types that I need in a lot of situations. Any interest for inclusion into boost? Here's a summary:
1. max_of<T> and min_of<T>: give the maximum and minimum value of any integral type as an integral constant expression; care is taken so that max_of<T>::value [min_of<T>::value] has the same type of the corresponding climits constant (CHAR_MAX, INT_MAX, etc.), i.e. the type to which an expression of type T is converted according to integral promotions. 2. promotes_to<T>: gives the type which the integral type T promotes to 3. has_sign<T>: simply defined as template <typename T> struct has_sign { static const bool value = min_of<T>::value < 0; }; Tells whether T is able to represent any negative value, regardless of whether the C++ standard calls it a signed integral type or not. 4. precision<T>: gives the precision of an integral type, which is the number of bits it uses to represent values, excluding any sign and padding bits. 5. width<T>: same as precision, but including any sign bit 6. has_padding<T>: says whether T has padding or not. The file intconst_log2.hpp is just used for the implementation of the remaining stuff. Genny. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost