The cxxomfort library adds among its Features a set of C++11 traits and helper utilities to its public interface. However, for its own use, it also adds a subset of the <type_traits> interface used to remove dependencies on compiler-specific or third-party Tr1 implementations where those might not be available (eg.: some Express versions of Visual C++).

In case they are required by client code (for example: to implement a backport of <type_traits> in a compiler that doesn't have it available) these traits are included in header cxxomfort/util/type_traits.hpp and defined under namespace cxxomfort::traits. They are not mapped to namespace std.

The traits defined are, for the most part, those that do not require compiler-specific intrinsics and those that deal with pointer and reference transformations.

List of type_traits defined by this library:

  • is_void, is_integral, is_floating_point, is_arithmetic, is_fundamental, used to identify C++'s native types and their behaviours.
  • is_[const|volatile] used for CV-awareness.
  • [add|remove]_const, [add|remove]_volatile, [add|remove]_cv, used for CV-awareness.
  • is_pointer, is_reference.
  • [add|remove]_pointer, [add|remove]_reference.
  • is_signed, is_unsigned.
  • make_signed, make_unsigned.
  • is_array, rank, extent, remove_extent, used for metaprogramming behaviour of array types.
  • is_same.
  • is_function (for function signatures w/up to 5 arguments).
  • is_empty (note: this is an approximation; does not use compiler intrinsics usually available).
  • is_enum, is_union (note: these require compiler intrinsics support such as __is_enum).

See also: