メインコンテンツ

matlab::data::Reference<T>

Array の要素への参照を取得するための、テンプレート化された C++ クラス

説明

Reference オブジェクトは、コピーを作成しない、Array の要素への参照です。Reference は次のとおりです。

  • 共有コピーではない

  • 参照を含む配列が有効である限り有効であり続ける

  • スレッドセーフではない

クラスの詳細

名前空間:

matlab::data

インクルード:

Reference.hpp

テンプレート パラメーター

T

参照先の要素の型。次のように指定します。

  • Array

  • Struct

  • Enumeration

  • MATLABString

  • すべての std::complex

コンストラクター

コピー コンストラクター

Reference(const Reference<T>& rhs)

パラメーター

const Reference<T>& rhs

コピーする値。

代入演算子のコピー

Reference<T>& operator=(const Reference<T>& rhs)

パラメーター

const Reference<T>& rhs

コピーする値。

戻り値

Reference<T>&

更新されたインスタンス。

移動代入演算子

Reference<T>& operator=(Reference<T>&& rhs)

パラメーター

Reference<T>&& rhs

移動させる値。

戻り値

Reference<T>&

更新されたインスタンス。

スロー

なし

移動コンストラクター

Reference(Reference<T>&& rhs)

説明

Reference オブジェクトの内容を新しいインスタンスに移動させます。

パラメーター

Reference<T>&& rhs

移動させる値。

スロー

なし

その他の演算子

operator=

Reference<T>& operator=(T rhs)

Reference<T>& operator=(std::string rhs)

Reference<T>& operator=(String rhs)

パラメーター

T rhs

代入する値。インデックス付けされる配列は非 const でなければなりません。

std::string rhs

代入する文字列。配列は非 const で、文字列の代入が許可されていなければなりません。

String rhs

StringArray に代入する文字列。インデックス付けされる配列は非 const でなければなりません。

戻り値

Reference<T>&

更新されたインスタンス。

スロー

なし

operator<<

std::ostream& operator <<(std::ostream& os, Reference<T> const& rhs)

パラメーター

std::ostream& os

 

Reference<T> const& rhs

 
戻り値

std::ostream&

 

operator T()

operator T() const

説明

配列から要素にキャストします。

戻り値

T

配列の要素の共有コピー。

スロー

なし

operator std::string()

operator std::string() const

説明

std::string に配列をキャストし、std::string のコピーを作成します。この演算子は、std::string にキャストできる型にのみ有効です。

戻り値

std::string

文字列。

スロー

matlab::data::NonAsciiCharInInputDataException

入力は std::string で、非 ASCII 文字を含みます。

std::runtime_error

MATLABString がありません。

フリー関数

operator==

inline bool operator ==(Reference<MATLABString> const& lhs, std::string const& rhs)

inline bool operator ==(std::string const& lhs, Reference<MATLABString> const& rhs)

inline bool operator ==(Reference<MATLABString> const& lhs, String const& rhs)

inline bool operator ==(String const& lhs, Reference<MATLABString> const& rhs)

inline bool operator ==(Reference<MATLABString> const& lhs, MATLABString const& rhs)

inline bool operator ==(MATLABString const& lhs, Reference<MATLABString> const& rhs)

inline bool operator ==(Reference<MATLABString> const& lhs, Reference<MATLABString> const& rhs)

template<typename T> bool operator ==(Reference<T> const& lhs, T const& rhs)

template<typename T> bool operator ==(T const& lhs, Reference<T> const& rhs)

template<typename T> bool operator ==(Reference<T> const& lhs, Reference<T> const& rhs)

パラメーター

Reference<MATLABString> const& lhs

std::string const& rhs

比較する値。

std::string const& lhs

Reference<MATLABString> const& rhs

Reference<MATLABString> const& lhs

String const& rhs

String const& lhs

Reference<MATLABString> const& rhs

Reference<MATLABString> const& lhs

MATLABString const& rhs

MATLABString const& lhs

Reference<MATLABString> const& rhs

Reference<MATLABString> const& lhs

Reference<MATLABString> const& rhs

Reference<T> const& lhs

T const& rhs

T const& lhs

Reference<T> const& rhs

Reference<T> const& lhs

Reference<T> const& rhs

戻り値

bool

値が等しい場合、true を返します。

スロー

std::runtime_error

引数を MATLABString と比較できません。

バージョン履歴

R2017b で導入