Provide a consistent interface for platform-dependent types.
More...
Detailed Description
- Outline
-
-
- Purpose:
- Provide a consistent interface for platform-dependent types.
-
- Classes:
-
-
- Description:
- This component provides a namespace for a set of
typedef
s that provide a stable, portable interface to platform-dependent types. In particular, this component supplies portable typenames for signed and unsigned 64-bit integers (bsls::Types::Int64
and bsls::Types::Uint64
, respectively), as well as the preferred integral type denoting the number of elements in a container, and the number of bytes in a single block of memory supplied by an allocator (bsls::Types::size_type
).
-
- Usage:
- The following illustrates how some of the types supplied by this component might be used.
bsls::Types::Int64
and bsls::Types::Uint64
identify the preferred fundamental types denoting signed and unsigned 64-bit integers, respectively: Clients can use these types in the same way as an int
. Clients can also mix usage with other fundamental integral types: bsls::Types::Uint64 nationalDebt = 1000000000000ULL;
nationalDebt += stimulus;
unsigned int deficitReduction = 1000000000;
nationalDebt -= deficitReduction;
std::cout << "National Debt Level: " << nationalDebt << std::endl;
bsls::Types::size_type
identifies the preferred integral type denoting the number of elements in a container, and the number of bytes in a single block of memory supplied by an allocator. For example, a typical use is as a typedef
in an STL container: Note that Standard Library facilities that work with numeric types can be used with bsls::Types
as well. For example, the following code finds out some facts about bsls::Types::Int64
in a platform-independent way: std::cout << "Min Int64 value: "
<< std::numeric_limits<bsls::Types::Int64>::min() << std::endl
<< "Max Int64 value: "
<< std::numeric_limits<bsls::Types::Int64>::max() << std::endl;
Typedef Documentation