array::size_type

无符号类型的两个元素之间的距离。

typedef std::size_t size_type;

备注

无符号整数类型描述长度可以表示序列所有控件的对象。 为类型 std::size_t的同义词。

示例

 

// std__array__array_size_type.cpp 
// compile with: /EHsc 
#include <array> 
#include <iostream> 
 
typedef std::array<int, 4> Myarray; 
int main() 
    { 
    Myarray c0 = {0, 1, 2, 3}; 
 
// display contents " 0 1 2 3" 
    for (Myarray::const_iterator it = c0.begin(); 
        it != c0.end(); ++it) 
        std::cout << " " << *it; 
    std::cout << std::endl; 
 
// display distance last-first " 4" 
    Myarray::size_type diff = c0.end() - c0.begin(); 
    std::cout << " " << diff; 
    std::cout << std::endl; 
 
    return (0); 
    } 
 
  

要求

数组页眉: <>

命名空间: std

请参见

参考

<array>

array 类 (STL)

array::empty