Typedef - Usage in C++

Usage in C++

In C++ type names can be very complicated and typedef provides a mechanism to assign a simple name to the type. Consider:

std::vector > values; for (std::vector >::const_iterator i = values.begin; i != values.end; ++i) { std::pair const & t = *i; // do something }

and

typedef std::pair value_t; typedef std::vector values_t; values_t values; for (values_t::const_iterator i = values.begin; i != values.end; ++i) { value_t const & t = *i; // do something }

Read more about this topic:  Typedef

Famous quotes containing the word usage:

    I am using it [the word ‘perceive’] here in such a way that to say of an object that it is perceived does not entail saying that it exists in any sense at all. And this is a perfectly correct and familiar usage of the word.
    —A.J. (Alfred Jules)