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

動的2次元配列クラス [詳解]

#include <mgl_array_2d.h>

公開メンバ関数

 Array2D (Array2D &)=delete
 
Array2Doperator= (Array2D &)=delete
 
 Array2D (Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 コンストラクタ
 
 Array2D (IndexType width, IndexType height, Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 コンストラクタ
 
 Array2D (IndexType width, IndexType height, const ValueType &invalidValue, Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 コンストラクタ
 
 Array2D (IndexType width, IndexType height, ValueType &&invalidValue, Memory::ClearMode clearMode=Memory::ClearMode::Auto) noexcept
 コンストラクタ
 
 Array2D (Array2D &&rhs) noexcept
 ムーブコンストラクタ
 
Array2Doperator= (Array2D &&rhs) noexcept
 ムーブ代入
 
 ~Array2D () noexcept
 デストラクタ
 
bool New (size_t width, size_t height, 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 x, IndexType y) const noexcept
 要素の取得
 
const ValueType & Get (const std::pair< IndexType, IndexType > &pair) const noexcept
 要素の取得
 
const ValueType & operator[] (const std::pair< IndexType, IndexType > &pair) const noexcept
 添字演算子による要素の取得
 
constexpr ValueType * GetPtr (IndexType x, IndexType y) const noexcept
 書き込み可能な要素へのポインタを取得
 
constexpr ValueType * GetPtr (const std::pair< IndexType, IndexType > &pair) const 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 beginX, IndexType beginY, IndexType endX, IndexType endY, LoopBody body) noexcept
 範囲を指定して要素にアクセス
 
template<class LoopBody >
constexpr void ForRange (const std::pair< IndexType, IndexType > &begin, const std::pair< IndexType, IndexType > &end, LoopBody body) noexcept
 範囲を指定して要素にアクセス
 
template<class LoopBody >
constexpr void ForRange (IndexType beginX, IndexType beginY, IndexType endX, IndexType endY, LoopBody body) const noexcept
 範囲を指定して読み取り専用で要素にアクセス
 
template<class LoopBody >
constexpr void ForRange (const std::pair< IndexType, IndexType > &begin, const std::pair< IndexType, 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 IndexType GetWidth () const noexcept
 配列のX方向の最大値を取得
 
constexpr IndexType GetHeight () const noexcept
 配列のY方向の最大値を取得
 
constexpr size_t GetArraySize () 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で取得
 

静的公開メンバ関数

static constexpr std::pair< IndexType, IndexType > MakePair (IndexType x, IndexType y) noexcept
 ペアの生成
 

詳解

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

動的2次元配列クラス

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

構築子と解体子

◆ Array2D() [1/5]

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

コンストラクタ

引数
[in]clearModeメモリ領域の初期化方法

◆ Array2D() [2/5]

template<class ValueType , class IndexType = size_t>
MGL::Array2D< ValueType, IndexType >::Array2D ( IndexType width,
IndexType height,
Memory::ClearMode clearMode = Memory::ClearMode::Auto )
inlinenoexcept

コンストラクタ

引数
[in]widthX方向の最大値
[in]heightY方向の最大値
[in]clearModeメモリ領域の初期化方法

◆ Array2D() [3/5]

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

コンストラクタ

引数
[in]widthX方向の最大値
[in]heightY方向の最大値
[in]invalidValue無効値として設定する値
[in]clearModeメモリ領域の初期化方法

◆ Array2D() [4/5]

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

コンストラクタ

引数
[in]widthX方向の最大値
[in]heightY方向の最大値
[in]invalidValue無効値として設定する値(右辺値参照)
[in]clearModeメモリ領域の初期化方法

◆ Array2D() [5/5]

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

ムーブコンストラクタ

引数
[in]rhs右辺値

関数詳解

◆ begin()

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

先頭の要素を取得

戻り値
先頭の要素

◆ cbegin()

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

先頭の要素をconstで取得

戻り値
先頭の要素

◆ cend()

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

末尾の要素をconstで取得

戻り値
末尾の要素

◆ Contains() [1/2]

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

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

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

◆ Contains() [2/2]

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

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

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

◆ end()

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

末尾の要素を取得

戻り値
末尾の要素

◆ Fill()

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

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

引数
[in]value書き込む値

◆ ForEach() [1/2]

template<class ValueType , class IndexType = size_t>
template<class LoopBody >
void MGL::Array2D< 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::Array2D< ValueType, IndexType >::ForEach ( LoopBody body)
inlineconstexprnoexcept

全ての要素へのアクセス

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

◆ ForRange() [1/4]

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

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

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

◆ ForRange() [2/4]

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

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

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

◆ ForRange() [3/4]

template<class ValueType , class IndexType = size_t>
template<class LoopBody >
void MGL::Array2D< ValueType, IndexType >::ForRange ( IndexType beginX,
IndexType beginY,
IndexType endX,
IndexType endY,
LoopBody body ) const
inlineconstexprnoexcept

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

テンプレート引数
LoopBody要素にアクセスするための関数オブジェクトの型
引数
[in]beginXX座標の開始位置
[in]beginYY座標の開始位置
[in]endXX座標の終了位置
[in]endYY座標の終了位置
[in]body要素にアクセスするための関数オブジェクト

◆ ForRange() [4/4]

template<class ValueType , class IndexType = size_t>
template<class LoopBody >
void MGL::Array2D< ValueType, IndexType >::ForRange ( IndexType beginX,
IndexType beginY,
IndexType endX,
IndexType endY,
LoopBody body )
inlineconstexprnoexcept

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

テンプレート引数
LoopBody要素にアクセスするための関数オブジェクトの型
引数
[in]beginXX座標の開始位置
[in]beginYY座標の開始位置
[in]endXX座標の終了位置
[in]endYY座標の終了位置
[in]body要素にアクセスするための関数オブジェクト

◆ Get() [1/2]

template<class ValueType , class IndexType = size_t>
const ValueType & MGL::Array2D< ValueType, IndexType >::Get ( const std::pair< IndexType, IndexType > & pair) const
inlinenodiscardnoexcept

要素の取得

引数
[in]pairIndexType型のXとYのペア
戻り値
XとYに対応した要素の参照。範囲外の場合は無効値。

◆ Get() [2/2]

template<class ValueType , class IndexType = size_t>
const ValueType & MGL::Array2D< ValueType, IndexType >::Get ( IndexType x,
IndexType y ) const
inlinenodiscardconstexprnoexcept

要素の取得

引数
[in]x取得する要素のX座標
[in]y取得する要素のY座標
戻り値
XとYに対応した要素の参照。範囲外の場合は無効値。

◆ GetArraySize()

template<class ValueType , class IndexType = size_t>
size_t MGL::Array2D< ValueType, IndexType >::GetArraySize ( ) const
inlinenodiscardconstexprnoexcept

配列全体のサイズを取得

戻り値
配列全体のサイズ

◆ GetHeight()

template<class ValueType , class IndexType = size_t>
IndexType MGL::Array2D< ValueType, IndexType >::GetHeight ( ) const
inlinenodiscardconstexprnoexcept

配列のY方向の最大値を取得

戻り値
Y方向の最大値

◆ GetPtr() [1/2]

template<class ValueType , class IndexType = size_t>
ValueType * MGL::Array2D< ValueType, IndexType >::GetPtr ( const std::pair< IndexType, IndexType > & pair) const
inlinenodiscardconstexprnoexcept

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

引数
[in]pairIndexType型のXとYのペア
戻り値
XとYが範囲内であれば要素へのポインタ、範囲外の場合はnullptr。

◆ GetPtr() [2/2]

template<class ValueType , class IndexType = size_t>
ValueType * MGL::Array2D< ValueType, IndexType >::GetPtr ( IndexType x,
IndexType y ) const
inlinenodiscardconstexprnoexcept

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

引数
[in]x取得する要素のX座標
[in]y取得する要素のY座標
戻り値
XとYが範囲内であれば要素へのポインタ、範囲外の場合はnullptr。

◆ GetWidth()

template<class ValueType , class IndexType = size_t>
IndexType MGL::Array2D< ValueType, IndexType >::GetWidth ( ) const
inlinenodiscardconstexprnoexcept

配列のX方向の最大値を取得

戻り値
X方向の最大値

◆ MakePair()

template<class ValueType , class IndexType = size_t>
static constexpr std::pair< IndexType, IndexType > MGL::Array2D< ValueType, IndexType >::MakePair ( IndexType x,
IndexType y )
inlinestaticnodiscardconstexprnoexcept

ペアの生成

引数
[in]xX座標
[in]yY座標
戻り値
xとyのペア

◆ New()

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

配列の生成

引数
[in]width配列の幅
[in]height配列の高さ
[in]clearModeメモリ領域の初期化方法
戻り値
true成功
false失敗

◆ operator=()

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

ムーブ代入

引数
[in]rhs右辺値

◆ operator[]()

template<class ValueType , class IndexType = size_t>
const ValueType & MGL::Array2D< ValueType, IndexType >::operator[] ( const std::pair< IndexType, IndexType > & pair) const
inlinenodiscardnoexcept

添字演算子による要素の取得

引数
[in]pairIndexType型のXとYのペア
戻り値
XとYに対応した要素の参照。範囲外の場合は無効値。

◆ Renew()

template<class ValueType , class IndexType = size_t>
bool MGL::Array2D< 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::Array2D< ValueType, IndexType >::SetInvalidValue ( const ValueType & value)
inlineconstexprnoexcept

無効値の設定

引数
[in]value設定する値

◆ SetInvalidValue() [2/2]

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

無効値の設定

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

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