バリデーションテンプレート関数に参照のリストを渡して別の関数に渡そうとします。私が書いたコードは以下の通りです:バリデーションテンプレートへの参照を渡すと、std :: reference-wrapperが使用されます
template <typename T>
void fun(cv::Point_<T> & pt) { pt.x++; pt.y++; }
template <class ... args>
void caller(args & ... list) {
typedef typename std::tuple_element<0, std::tuple<args...> >::type T;
std::array<std::reference_wrapper<T>, sizeof...(list)> values {list ... };
for(int i=0; i<values.size(); i++)
fun(values[i]);
}
、私はこのように機能の発信者を呼び出す:
cv::Point2f a, b, c;
caller(a, b, c);
コンパイラ私に次のエラーを与える:
No matching function for call to 'fun'
Candidate template ignored: could not match 'Point_' against 'reference_wrapper'
私は行方不明?
あなたは何をしようとしていますか?参照ラッパーは不要です。あなたは実際に各引数に対して 'fun'を呼び出そうとしていますか? –
多かれ少なかれ。しかし、私の質問のコードは、実際のものの単純化です。 – thewoz