I have this code:
template < typename TFunc >
class Foo
{
public:
Foo(TFunc func) : func_(func) {}
Foo(Foo<TFunc> const &) = delete;
Foo<TFunc> & operator=(Foo<TFunc> const &) = delete;
Foo(Foo<TFunc> &&) = default;
Foo<TFunc> & operator=(Foo<TFunc> &&) = default;
private:
TFunc func_;
};
int main()
{
auto func = []() {};
auto f = Foo<decltype(func)>(func);
return 0;
}
When I compile this code with Visual Studio 2015 with the /Wallflag, I get the following warning:
C5027 'Foo<main::<lambda_e5404f82e4b38ca1d164ce09039df46c>>': move assignment operator was implicitly defined as deleted
I don't understand why the move assignment operator would be implicitly defined as deleted while it is explicitely defined as defaulted. Any idea?
Aucun commentaire:
Enregistrer un commentaire