Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2008-07-17 04:02:13


I just added some class templates that had declarations like:

//========================================
template < intmax_t Value >
     struct whatever;
//========================================

Afterwards, I was looking over some of the Boost.Integer headers and
got curious about the BOOST_NO_INTEGRAL_INT64_T setting used within
<boost/integer_traits.hpp>. I think we could add two typedefs to
<boost/cstdint.hpp>

//========================================
#if !defined(BOOST_NO_INT64_T) && defined(BOOST_NO_INTEGRAL_INT64_T)
     typedef signed long intmaxc_t;
     typedef unsigned long uintmaxc_t;
#else
     typedef intmax_t intmaxc_t;
     typedef uintmax_t uintmaxc_t;
#endif
//========================================

Where "intmaxc_t" is the largest signed integer type that is suitable
for integer constant expressions (like value-based template
parameters) and "uintmaxc_t" is the unsigned equivalent. They should
be the same as "intmax_t" and "uintmax_t" on non-broken compilers.
I'd change my code to use the new types, to be safer.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

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