喜欢:
std::string<T>::size_type
std::list<T>::size_type
std::map<T>::size_type
std::vector<T>::size_type
无论cplusplus.com和cppreference.com说,他们通常size_t
,但他们真正的,明确保障的标准是size_t
,除非使用自定义分配器?
对于STL容器-不。[container.requirements.general]中的标准表96列出了任何容器的容器要求X
,解释起来很清楚:
但是,对于basic_string
,size_type
定义为
typedef typename allocator_traits<Allocator>::size_type size_type;
这反过来将size_t
用于std::allocator<..>
为分配器。
此外,std::array
使用size_t
如size_type
,根据[array.overview] / 3。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句