わからない: は、私はそうでテンプレートのマクロ何をしようとしていることは悪いですが、ここで私の質問だ場合
std::vector<T> operator - (const std::vector<T>& data1, const std::vector<T>& data2);
std::vector<T> operator * (const std::vector<T>& data1, const std::vector<T>& data2);
std::vector<T> operator & (const std::vector<T>& data1, const std::vector<T>& data2);
ようないくつかのテンプレート機能を持っている....と。これらすべての機能は、オペレータ以外はまったく同じ定義を持っているので、私はこの
#define _BINARY_OP_ON_DATASET (OP_TYPE)
template <typename T> \
std::vector<T> operator OP_TYPE (const std::vector<T>& data1, const std::vector<T>& data2)\
{\
std::vector<T> result;\
result.push_back(data1.begin().val OP_TYPE data1.begin().val)/*sample implementation*/\
return result;\
}
_BINARY_OP_ON_DATASET (&)
_BINARY_OP_ON_DATASET (+)
ようなマクロを書くしようとしていたと私はエラー
Error 1 error C2833: 'operator OP_TYPE' is not a recognized operator or type
Error 2 error C2988: unrecognizable template declaration/definition
Error 3 error C2059: syntax error : 'newline'
Error 5 error C2143: syntax error : missing ';' before '<'
Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
...ともっとの束を得ます 誰もがこの問題を見てもらえますか?
ありがとうございました。
CV
'+' 'T 'を含む2つのベクトルにどのように行きますか?そして、あなたはどのように2つのベクトルを '&'と '--'にしますか? – Nawaz
私の悪い..それはタイプミス、編集されたコード – blueskin
ok .. Kerrek SBとildjarnが指摘するように、彼らは愚かな構文ミスです。 – blueskin