Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2000-01-05 17:13:41

I've messed around with the type traits as we have them so far, and have
come up with the following scheme for type classification:

Basically, for numeric types, I chose the following numeric categories as
suggested by the Standard:
  unsigned integral
  signed integral
  integral (= unsigned integral + signed integral
      + any integral types without defined 'signedness' (bool, char,
  arithmetic (= integral + floating-point)
  fundamental (= arithmetic + void)

Also, according to the Standard, these categories only contain non-cv-qual

Then I divided these numeric types into three sources:
  standard - those types specifically required by the Standard
  extension - those types provided as a compiler extension
  user-supplied - those types that specialize std::numeric_limits
And created the following categories:
  standard - any numeric type of standard source
  extension - any numeric type of extension source (NOT standard)
  builtin (= standard + extension)
  {no name} - the default includes all sources

The naming convention is:
  is_ {source category} _ {numeric category}
  is_integral<BigInt>::type == true
  is_integral<int>::type == true
  is_builtin_integral<BigInt>::type == false
  is_builtin_integral<int>::type == true

  is_standard_signed_integral<int>::type == true
  is_standard_integral<long long int>::type == false
  is_extension_integral<long long int>::type == true
  is_builtin_integral<long long int>::type == true

A few other changes were made (I include references to the Standard as to
why I think they should be this way):
  . is_pointer returns false for cv-qualified types (3.9.2p3, 3.9.3p1)
  . is_pointer returns false for member pointers (3.9.2p3)
  . has_* returns true for volatile types (3.9p3, 3.9p10)
  . is_POD returns false for reference types (3.9p10)
  . is_POD returns true for volatile types (3.9p10)

A word on has_* and reference types: I couldn't figure out which ones
references should have, so I have temporarily made them all invalid for
reference types.

Also added were some simple instructions on how to determine how trustworthy
some type traits are (i.e., is_class, is_enum), and whether they will return
'true' or 'false' if they don't know. The type traits may be made fail-safe
for any UDT by specialization, following the method suggested in the header
with examples in the test file.

Please see the header file for detailed comments. Both files have been
uploaded to the Boost vault.


P.S. The test file was also somewhat updated -- it still needs a lot of
work, though. . .

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