はshared_ptr<T>(new T(...))
がちょうどコンパイルのに対し、私は、グラムでコンパイルエラー++ 4.6を取得しboost::make_shared<T>(...)
を使用するときに1.42を後押ししていません良い。残念ながら、私は最小限の例を分離することはできませんでした(両方ともにうまくコンパイルしてみました)が、おそらく誰かが私にその違いを説明することができました。ブースト:: make_shared <T>(...)コンパイルされません、shared_ptrの<T>(新しいT(...))は
f=make_shared<ResidualsFunctor>(0,0,this);
が私に語ったのに対し、この
f=shared_ptr<ResidualsFunctor>(new ResidualsFunctor(0,0,this)); // this is a StaticEquilibriumSolver*
がうまくコンパイル
ResidualsFunctor(int,int,StaticEquilibriumSolver*)
:
私はResidualsFunctor
は以下のctorを持ってshared_ptr<ResidualsFunctor> f
、のインスタンスをinstatiatingい
/usr/include/boost/smart_ptr/make_shared.hpp: In function 'boost::shared_ptr<T> boost::make_shared(Args&& ...) [with T = StaticEquilibriumSolver::ResidualsFunctor, Args = int, int, StaticEquilibriumSolver* const]':
pkg/sparc/SparcField.cpp:472:49: instantiated from here
/usr/include/boost/smart_ptr/make_shared.hpp:148:5: error: no matching function for call to 'forward(int&)'
/usr/include/boost/smart_ptr/make_shared.hpp:148:5: note: candidate is:
/usr/include/boost/smart_ptr/make_shared.hpp:90:40: note: template<class T> T&& boost::detail::forward(T&&)
ブーストのバグですか? gccで?私が見ない私のせい?
これはBoostの 'std :: forward'に相当するものとあなたのコンパイラとの間の奇妙な相互作用のようです。どのコンパイラのバージョンを使用していますか?使用しているBoostのバージョンは? –
g ++ 4.6の質問で指定され、1.42をブーストします。 – eudoxos