Share via


collection_adapter::size (STL/CLR)

Counts the number of elements.

    size_type size();

Remarks

The member function returns the length of the controlled sequence. It is not defined in a specialization for IEnumerable or IEnumerable<Value>.

Example

// cliext_collection_adapter_size.cpp 
// compile with: /clr 
#include <cliext/adapter> 
#include <cliext/deque> 
 
typedef cliext::collection_adapter< 
    System::Collections::ICollection> Mycoll; 
int main() 
    { 
    cliext::deque<wchar_t> d6x(6, L'x'); 
    Mycoll c1(%d6x); 
 
// display initial contents " x x x x x x" 
    for each (wchar_t elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
    System::Console::WriteLine("size() = {0}", c1.size()); 
    return (0); 
    } 
 
 x x x x x x
size() = 6

Requirements

Header: <cliext/adapter>

Namespace: cliext

See Also

Reference

collection_adapter (STL/CLR)