共用方式為


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