Opened 15 years ago

Last modified 14 years ago

#1227 new Feature Requests

Original/Signed/Unsigned Integer Variant Selection Templates

Reported by: Daryle Walker Owned by: Daryle Walker
Milestone: To Be Determined Component: integer
Version: Severity: Not Applicable
Keywords: Cc:

Description

Add new integer selection templates to "boost/integer.hpp" for

  • The underlying type for a given integral type. This could be called underlying and would map
    • char to whichever of {signed char, unsigned char} that shares the same values (section 3.9.1, paragraph 1 of the 2003 C++ standard)
    • wchar_t to its underlying type (paragraph 5 of the same part of the standard)
    • any other type to itself (This includes bool because it could be implemented distinctly from any other integral type.)
    • (Someday: extend this to find the underlying type of an enumeration)
  • Find the unsigned equivalent of a given signed integral type, like the get_unsigned examples at source:/tags/Version_1_34_1/boost/boost/typeof/int_encoding.hpp and source:/tags/Version_1_34_1/boost/boost/wave/util/flex_string.hpp
  • Find the signed equivalent of a given unsigned integral type, as a dual to the previous point (for both templates, non-matching types return themselves)

Change History (1)

comment:1 by Daryle Walker, 14 years ago

The last two points are already fulfilled by the Type Traits library via the [source:/trunk/boost/type_traits/make_signed.hpp@42899 boost::make_signed] and [source:/trunk/boost/type_traits/make_unsigned.hpp@42899 boost::make_unsigned] class templates.

Note: See TracTickets for help on using tickets.