CPP07 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Array< T > クラステンプレート

A template class that represents a dynamic array. [詳解]

#include <Array.hpp>

Array< T > 連携図
Collaboration graph

クラス

class  OutOfBoundsException
 Exception thrown when trying to access an element outside the array bounds. [詳解]
 

公開メンバ関数

 Array ()
 Default constructor. Creates an empty Array.
 
 Array (unsigned int n)
 Constructor with size. Creates an Array of n elements.
 
 Array (const Array &other)
 Copy constructor. Creates a deep copy of another Array.
 
 ~Array ()
 Destructor. Frees the allocated memory.
 
Arrayoperator= (Array other)
 Assignment operator. Replaces the contents with a copy of another Array.
 
Toperator[] (unsigned int index)
 Subscript operator for non-const access.
 
const Toperator[] (unsigned int index) const
 Subscript operator for const access.
 
unsigned int size () const
 Returns the number of elements in the Array.
 

詳解

template<typename T>
class Array< T >

A template class that represents a dynamic array.

テンプレート引数
TThe type of elements stored in the array.

Array.hpp29 行目に定義があります。

構築子と解体子

◆ Array() [1/3]

template<typename T >
Array< T >::Array ( )

Default constructor. Creates an empty Array.

◆ Array() [2/3]

template<typename T >
Array< T >::Array ( unsigned int  n)
explicit

Constructor with size. Creates an Array of n elements.

引数
nThe number of elements to create.

◆ Array() [3/3]

template<typename T >
Array< T >::Array ( const Array< T > &  other)

Copy constructor. Creates a deep copy of another Array.

引数
otherThe Array to copy from.

◆ ~Array()

template<typename T >
Array< T >::~Array ( )

Destructor. Frees the allocated memory.

関数詳解

◆ operator=()

template<typename T >
Array & Array< T >::operator= ( Array< T other)

Assignment operator. Replaces the contents with a copy of another Array.

引数
otherThe Array to assign from.
戻り値
A reference to the current instance.

◆ operator[]() [1/2]

template<typename T >
T & Array< T >::operator[] ( unsigned int  index)

Subscript operator for non-const access.

引数
indexThe index of the element to access.
戻り値
A reference to the element at the specified index.
例外
OutOfBoundsExceptionif the index is out of bounds.

◆ operator[]() [2/2]

template<typename T >
const T & Array< T >::operator[] ( unsigned int  index) const

Subscript operator for const access.

引数
indexThe index of the element to access.
戻り値
A const reference to the element at the specified index.
例外
OutOfBoundsExceptionif the index is out of bounds.

◆ size()

template<typename T >
unsigned int Array< T >::size ( ) const

Returns the number of elements in the Array.

戻り値
The number of elements.

このクラス詳解は次のファイルから抽出されました: