次のコードは、clang-3.8とgcc 4.9.3でうまくコンパイルされます。削除されたコピー代入演算子のVS 2015 Update 3エラー
ただし、VS 2015 Update 3でコンパイルすると、次のエラーメッセージが表示されて失敗します。
c:\program files (x86)\microsoft visual studio 14.0\vc\include\xutility(458): error C2280: 'MyInsert &MyInsert::operator =(const MyInsert &)': attempting to reference a deleted function
test\mytests\main.cpp(33): note: compiler has generated 'MyInsert::operator =' here
c:\program files (x86)\microsoft visual studio 14.0\vc\include\algorithm(926): note: see reference to function template instantiation '_Iter &std::_Rechecked<_OutIt,_OutIt>(_Iter &,_UIter)' being compiled
with
[
_Iter=MyInsert,
_OutIt=MyInsert,
_UIter=MyInsert
]
c:\program files (x86)\microsoft visual studio 14.0\vc\include\algorithm(950): note: see reference to function template instantiation '_OutIt std::_Transform_no_deprecate1<const foo**,_OutIt,_Fn1>(_InIt,_InIt,
_OutIt,_Fn1 &,std::input_iterator_tag,std::_Any_tag)' being compiled
with
[
_OutIt=MyInsert,
_Fn1=test::method::<lambda_45e8626339fc29aadca2bf2dd3420511>,
_InIt=const foo **
]
c:\program files (x86)\microsoft visual studio 14.0\vc\include\algorithm(960): note: see reference to function template instantiation '_OutIt std::_Transform_no_deprecate<_InIt,_OutIt,_Fn1>(_InIt,_InIt,_OutIt,
_Fn1 &)' being compiled
with
[
_OutIt=MyInsert,
_InIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<const foo *>>>,
_Fn1=test::method::<lambda_45e8626339fc29aadca2bf2dd3420511>
]
test\mytests\main.cpp(45): note: see reference to function template instantiation '_OutIt std::transform<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<const
foo *>>>,MyInsert,test::method::<lambda_45e8626339fc29aadca2bf2dd3420511>>(_InIt,_InIt,_OutIt,_Fn1)' being compiled
with
[
_OutIt=MyInsert,
_InIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<const foo *>>>,
_Fn1=test::method::<lambda_45e8626339fc29aadca2bf2dd3420511>
]
]
私はできないですが、それ(VSコンパイラは)void *
を取り、明確に1が明示的に提供されたときにMyInsert &
をバック与えコピー代入演算子を見つけることができない理由を理解しています。もっと(エラーメッセージトレースを以下による)に
c:\program files (x86)\microsoft visual studio14.0\vc\include\xutility
と
c:\program files (x86)\microsoft visual studio14.0\vc\include\algorithm
を掘る
も、私はstd::transformation
アルゴリズムが呼び出される実際の関数は、明示的に提供することを実感しましたコピーの割り当てが呼び出された後、_Rechecked
と入力され、に入ります0ヘッダ。
このアサインでは、コピー代入演算子が呼び出され(MyInsert&
として入力され、出力がMyInsert&
)、見つからないため、attempting to reference...
というエラーメッセージが表示されます。
この分析は正しいですか?そうでなければ、なぜ他のメジャーなコンパイラでコンパイルされているコードをコンパイルできないのですか?おそらくバグでしょうか?私が使っていることを
P.S
現在の仕事の周りには、非基準部材とMyInsert
クラスの参照メンバーを削除することです。
@Oktalistああ、私の悪い! – Yakk