std::type_info::before

bool before( const type_info& rhs );

Returns true if the referred type precedes type, referred to by rhs in the implementation's collation order. No guarantees are given, in particular, the collation order can change between the invocations of the same program.

Parameters

rhs - another type information object to compare to

Return value

true if the referred type precedes type, referred to by rhs in the implementation's collation order.

Example

#include <iostream>
#include <typeinfo>
 
int main()
{
  if(typeid(int).before(typeid(char)))
    std::cout << "int goes before char in this implementation.\n";
  else
    std::cout << "char goes before int in this implementation.\n";
}

Possible output:

char goes before int in this implementation.

See also

checks whether the objects refer to the same type
(public member function)
doc_CPP
2016-10-11 10:07:36
Comments
Leave a Comment

Please login to continue.