0

コンパイラをVisualStudioからg++に変更していますが、関数の引数での参照渡しに問題があります。

Visual Studioでは、機能は次のとおりです。

void Foo(int&a, int&b)

この関数でa、bが変更されるようにします。したがって、g++では使用できません

void Foo(const int&a, const int &b)

また、右辺値の参照は私のg++では許可されていません。

void Foo( int&& a, int&& b)

それで、ポインタを使用することがコードを変換する唯一の方法ですか?

void Foo( int* a, int* b)

P / S:これはg++でコンパイルするときのエラーです:

error: no matching function for call to ‘Steerable::buildSCFpyrLevs(Tensor<double, 2ul>, std::vector<Tensor<double, 2ul> >&, int&, int&, int&, bool&)’
Steerable.cpp:63:100: note: candidate is:
Steerable.h:93:7: note: void Steerable::buildSCFpyrLevs(Steerable::data_ref, std::vector<Tensor<double, 2ul> >&, int, int, int, bool)
Steerable.h:93:7: note:   no known conversion for argument 1 from ‘Tensor<double, 2ul>’ to ‘Steerable::data_ref {aka Tensor<double, 2ul>&}’

そして、関数宣言は次のとおりです。

typedef Tensor<value_type,2> data_type;
typedef data_type& data_ref;


vector<Steerable::data_type>& Steerable::buildSCFpyr(Steerable::c_data_ref im, int nLevel, int nDir, int twidth, bool subsample)

エラーのある行:

buildSCFpyrLevs(imdft.FreqComplexFilter(toComplex(lo0mask)),pyr_freq,nLevel,nDir,twidth, subsample);
4

1 に答える 1

1

FreqComplexFilterおそらく参照によって戻ってこないでしょう。

汚い修正:

Tensor<double, 2> tempVal = imdft.FreqComplexFilter(toComplex(lo0mask));
buildSCFpyrLevs(tempVal, pyr_freq, nLevel, nDir, twidth, subsample);

コードをコンパイルするだけで、根本的な設計の問題は修正されないため、ダーティです(問題は、buildSCFpyrLevsによって返される一時的な値を変更する理由ですFreqComplexFilter)。

于 2013-03-03T22:51:20.710 に答える