Name

type_info class — Type information

Synopsis

class type_info {
public:
  virtual ~type_info(  );
  bool operator==(const type_info& rhs) const;
  bool operator!=(const type_info& rhs) const;
  bool before(const type_info& rhs) const;
  const char* name(  ) const;
private:
  type_info(const type_info& rhs);
  type_info& operator=(const type_info& rhs);
};
See Also

The typeid operator (described in Chapter 3) returns a static type_info object. The type information includes the type's name and a collation order, both of which are implementation-defined. An implementation might derive classes from type_info to provide additional information.

Note that the copy constructor and assignment operators are inaccessible, so you must store pointers if you want to use a standard container. Example 13-38 shows how to store type_info pointers in a set, where the order is determined by the before member function.

Example

The members of type_info are: