Why do C++ STL containers (vector in the example above) use a lot of typeef internally?
I thought that the possibility of misuse would increase by defining member types as new model names in typeef.
I would like to know the reason why I have to redefine it with a different model name.
template<class T,class Allocator=std::allocator<T>>
class vector {
public:
/* member types*/
typeedefT value_type;
typeedef Allocator allocator_type;
typeef std::size_t size_type;
typeef std::ptrdiff_t difference_ptr;
typeef value_type&reference;
typeef const value_type&const_reference;
typeedef typename Allocator::pointer pointer;
typeedef typenameAllocator::const_pointer const_pointer;
typeedef pointerator;
typeedef const_pointer const_iterator;
typeefft::reverse_iterator<iterator>reverse_iterator;
typeefft::reverse_iterator<const_iterator>const_reverse_iterator;
The processing system (the library provided with ) is designed to allow you to choose the appropriate type for your running environment.
For example, std::vector<T>::size_type
is only implemented in that environment, and language specifications do not dictate that you should.
© 2024 OneMinuteCode. All rights reserved.