(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

The 'Is A' Traits

Description: Temporary fillers for the 'is a xxx' fundamental type traits till C++0x is widespread.

Keywords: ecl type traits

Tutorial Level: INTERMEDIATE

These are in the upcoming C++0x standard, so are only a temporary feature in the ecl. They are a subset and work just like boosts type traits. More will be added as needed. The code snippet below is for runtime code, but they're actually more useful with enable_if in determining which compile time template specialisations to instantiate.

   1 if ( is_float<double>::value ) {
   2   // take some action
   3 }

The current list include:

  • ecl::is_integral

  • ecl::is_signed

  • ecl::is_unsigned

  • ecl::is_float

  • ecl::is_byte

  • ecl::is_signed_byte

  • ecl::is_unsigned_byte

Wiki: ecl_type_traits/Tutorials/The 'Is A' Traits (last edited 2012-02-01 13:24:24 by DanielStonier)