Given the following piece of code:
template<typename T>
class MyContainer
{
typedef T value_type;
typedef unsigned int size_type;
...
};
How one should initialize variables using size_type (like loop indexes)?
Should it be:
for(size_type currentIndex = size_type(0);currentIndex < bound;++currentIndex)
or
for(size_type currentIndex = static_cast<size_type>(0);currentIndex < bound;++currentIndex)
The rationale for the question is to produce code that will still work when type underlying size_type is changed or added to template parameters.
Thanks...