次の方法で共有


array::size_type

The type of an unsigned distance between two element.

typedef std::size_t size_type;

Remarks

The unsigned integer type describes an object that can represent the length of any controlled sequence. It is a synonym for the type std::size_t.

Example

 

// 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); 
    } 
 
 0 1 2 3
 4

Requirements

Header: <array>

Namespace: std

See Also

Reference

<array>

array Class (STL)

array::empty