MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
MGL::Array< ValueType, IndexType > クラステンプレート

動的配列クラス [詳解]

#include <mgl_array.h>

公開メンバ関数

 Array (Array &)=delete
 
Arrayoperator= (Array &)=delete
 
 Array (size_t arraySize=0, Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 コンストラクタ
 
 Array (size_t arraySize, const ValueType &invalidValue, Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 コンストラクタ
 
 Array (size_t arraySize, ValueType &&invalidValue, Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 コンストラクタ
 
 Array (Array &&rhs) noexcept
 ムーブコンストラクタ
 
Arrayoperator= (Array &&rhs) noexcept
 ムーブ代入
 
 ~Array () noexcept
 デストラクタ
 
bool New (size_t arraySize, Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 配列の生成
 
bool Renew (Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 配列を同じサイズで構築し直す
 
constexpr void Fill (const ValueType &value) noexcept
 全ての要素を指定値で書き込む
 
constexpr const ValueType & Get (IndexType index) const noexcept
 要素の取得
 
constexpr const ValueType & operator[] (IndexType index) const noexcept
 添字による要素の取得
 
constexpr ValueType * GetPtr (IndexType index) noexcept
 書き込み可能な要素へのポインタを取得
 
template<class LoopBody >
constexpr void ForEach (LoopBody body) noexcept
 全ての要素へのアクセス
 
template<class LoopBody >
constexpr void ForEach (LoopBody body) const noexcept
 全ての要素へ読み取り専用でアクセス
 
template<class LoopBody >
constexpr void ForRange (IndexType begin, IndexType end, LoopBody body) noexcept
 範囲を指定して要素にアクセス
 
template<class LoopBody >
constexpr void ForRange (IndexType begin, IndexType end, LoopBody body) const noexcept
 範囲を指定して読み取り専用で要素にアクセス
 
constexpr bool Contains (const ValueType &element) const noexcept
 指定した要素が範囲内に含まれているかを取得
 
constexpr bool Contains (const ValueType *element) const noexcept
 指定した要素が範囲内に含まれているかを取得
 
constexpr void SetInvalidValue (const ValueType &value) noexcept
 無効値の設定
 
constexpr void SetInvalidValue (ValueType &&value) noexcept
 無効値の設定
 
constexpr size_t GetSize () const noexcept
 配列の要素数を取得
 
constexpr ValueType * begin () const noexcept
 先頭の要素を取得
 
constexpr ValueType * end () const noexcept
 末尾の要素を取得
 
constexpr const ValueType * cbegin () const noexcept
 先頭の要素をconstで取得
 
constexpr const ValueType * cend () const noexcept
 末尾の要素をconstで取得
 

詳解

template<class ValueType, class IndexType = size_t>
class MGL::Array< ValueType, IndexType >

動的配列クラス

テンプレート引数
ValueType配列が扱う型

構築子と解体子

◆ Array() [1/4]

template<class ValueType , class IndexType = size_t>
MGL::Array< ValueType, IndexType >::Array ( size_t arraySize = 0,
Memory::ClearMode clearMode = Memory::ClearMode::Auto )
inlineexplicitnoexcept

コンストラクタ

引数
[in]arraySize配列のサイズ
[in]clearModeメモリ領域の初期化方法

◆ Array() [2/4]

template<class ValueType , class IndexType = size_t>
MGL::Array< ValueType, IndexType >::Array ( size_t arraySize,
const ValueType & invalidValue,
Memory::ClearMode clearMode = Memory::ClearMode::Auto )
inlinenoexcept

コンストラクタ

引数
[in]arraySize配列のサイズ
[in]invalidValue無効値として設定する値
[in]clearModeメモリ領域の初期化方法

◆ Array() [3/4]

template<class ValueType , class IndexType = size_t>
MGL::Array< ValueType, IndexType >::Array ( size_t arraySize,
ValueType && invalidValue,
Memory::ClearMode clearMode = Memory::ClearMode::Auto )
inlinenoexcept

コンストラクタ

引数
[in]arraySize配列のサイズ
[in]invalidValue無効値として設定する値(右辺値参照)
[in]clearModeメモリ領域の初期化方法

◆ Array() [4/4]

template<class ValueType , class IndexType = size_t>
MGL::Array< ValueType, IndexType >::Array ( Array< ValueType, IndexType > && rhs)
inlinenoexcept

ムーブコンストラクタ

引数
[in]rhs右辺値

関数詳解

◆ begin()

template<class ValueType , class IndexType = size_t>
ValueType * MGL::Array< ValueType, IndexType >::begin ( ) const
inlinenodiscardconstexprnoexcept

先頭の要素を取得

戻り値
先頭の要素

◆ cbegin()

template<class ValueType , class IndexType = size_t>
const ValueType * MGL::Array< ValueType, IndexType >::cbegin ( ) const
inlinenodiscardconstexprnoexcept

先頭の要素をconstで取得

戻り値
先頭の要素

◆ cend()

template<class ValueType , class IndexType = size_t>
const ValueType * MGL::Array< ValueType, IndexType >::cend ( ) const
inlinenodiscardconstexprnoexcept

末尾の要素をconstで取得

戻り値
末尾の要素

◆ Contains() [1/2]

template<class ValueType , class IndexType = size_t>
bool MGL::Array< ValueType, IndexType >::Contains ( const ValueType & element) const
inlinenodiscardconstexprnoexcept

指定した要素が範囲内に含まれているかを取得

引数
[in]elementチェックする要素の参照
戻り値
true範囲内に含まれている要素である
false範囲内の要素ではない

◆ Contains() [2/2]

template<class ValueType , class IndexType = size_t>
bool MGL::Array< ValueType, IndexType >::Contains ( const ValueType * element) const
inlinenodiscardconstexprnoexcept

指定した要素が範囲内に含まれているかを取得

引数
[in]elementチェックする要素のポインタ
戻り値
true範囲内に含まれている要素である
false範囲内の要素ではない

◆ end()

template<class ValueType , class IndexType = size_t>
ValueType * MGL::Array< ValueType, IndexType >::end ( ) const
inlinenodiscardconstexprnoexcept

末尾の要素を取得

戻り値
末尾の要素

◆ Fill()

template<class ValueType , class IndexType = size_t>
void MGL::Array< ValueType, IndexType >::Fill ( const ValueType & value)
inlineconstexprnoexcept

全ての要素を指定値で書き込む

引数
[in]value書き込む値

◆ ForEach() [1/2]

template<class ValueType , class IndexType = size_t>
template<class LoopBody >
void MGL::Array< ValueType, IndexType >::ForEach ( LoopBody body) const
inlineconstexprnoexcept

全ての要素へ読み取り専用でアクセス

テンプレート引数
LoopBody要素にアクセスするための関数オブジェクトの型
引数
[in]body要素にアクセスするための関数オブジェクト

◆ ForEach() [2/2]

template<class ValueType , class IndexType = size_t>
template<class LoopBody >
void MGL::Array< ValueType, IndexType >::ForEach ( LoopBody body)
inlineconstexprnoexcept

全ての要素へのアクセス

テンプレート引数
LoopBody要素にアクセスするための関数オブジェクトの型
引数
[in]body要素にアクセスするための関数オブジェクト

◆ ForRange() [1/2]

template<class ValueType , class IndexType = size_t>
template<class LoopBody >
void MGL::Array< ValueType, IndexType >::ForRange ( IndexType begin,
IndexType end,
LoopBody body ) const
inlineconstexprnoexcept

範囲を指定して読み取り専用で要素にアクセス

テンプレート引数
LoopBody要素にアクセスするための関数オブジェクトの型
引数
[in]begin開始インデックス
[in]end終了インデックス
[in]body要素にアクセスするための関数オブジェクト

◆ ForRange() [2/2]

template<class ValueType , class IndexType = size_t>
template<class LoopBody >
void MGL::Array< ValueType, IndexType >::ForRange ( IndexType begin,
IndexType end,
LoopBody body )
inlineconstexprnoexcept

範囲を指定して要素にアクセス

テンプレート引数
LoopBody要素にアクセスするための関数オブジェクトの型
引数
[in]begin開始インデックス
[in]end終了インデックス
[in]body要素にアクセスするための関数オブジェクト

◆ Get()

template<class ValueType , class IndexType = size_t>
const ValueType & MGL::Array< ValueType, IndexType >::Get ( IndexType index) const
inlinenodiscardconstexprnoexcept

要素の取得

引数
[in]index取得する要素のインデックス
戻り値
インデックスに対応した要素の参照。範囲外の場合は無効値。

◆ GetPtr()

template<class ValueType , class IndexType = size_t>
ValueType * MGL::Array< ValueType, IndexType >::GetPtr ( IndexType index)
inlinenodiscardconstexprnoexcept

書き込み可能な要素へのポインタを取得

引数
[in]index取得する要素のインデックス
戻り値
インデックスが範囲内であれば要素へのポインタ、範囲外の場合はnullptr。

◆ GetSize()

template<class ValueType , class IndexType = size_t>
size_t MGL::Array< ValueType, IndexType >::GetSize ( ) const
inlinenodiscardconstexprnoexcept

配列の要素数を取得

戻り値
要素数

◆ New()

template<class ValueType , class IndexType = size_t>
bool MGL::Array< ValueType, IndexType >::New ( size_t arraySize,
Memory::ClearMode clearMode = Memory::ClearMode::Auto )
inlinenoexcept

配列の生成

引数
[in]arraySize配列のサイズ
[in]clearModeメモリ領域の初期化方法
戻り値
true成功
false失敗

◆ operator=()

template<class ValueType , class IndexType = size_t>
Array & MGL::Array< ValueType, IndexType >::operator= ( Array< ValueType, IndexType > && rhs)
inlinenoexcept

ムーブ代入

引数
[in]rhs右辺値

◆ operator[]()

template<class ValueType , class IndexType = size_t>
const ValueType & MGL::Array< ValueType, IndexType >::operator[] ( IndexType index) const
inlinenodiscardconstexprnoexcept

添字による要素の取得

引数
[in]index取得する要素のインデックス
戻り値
インデックスに対応した要素の参照。範囲外の場合は無効値。

◆ Renew()

template<class ValueType , class IndexType = size_t>
bool MGL::Array< ValueType, IndexType >::Renew ( Memory::ClearMode clearMode = Memory::ClearMode::Auto)
inlinenoexcept

配列を同じサイズで構築し直す

引数
[in]clearModeメモリ領域の初期化方法
戻り値
true成功
false失敗

◆ SetInvalidValue() [1/2]

template<class ValueType , class IndexType = size_t>
void MGL::Array< ValueType, IndexType >::SetInvalidValue ( const ValueType & value)
inlineconstexprnoexcept

無効値の設定

引数
[in]value設定する値

◆ SetInvalidValue() [2/2]

template<class ValueType , class IndexType = size_t>
void MGL::Array< ValueType, IndexType >::SetInvalidValue ( ValueType && value)
inlineconstexprnoexcept

無効値の設定

引数
[in]value設定する値(右辺値参照)

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