I have this simple program that doesn't compile
#include <future>
class Foo
{
public:
    ~Foo();
    std::future<int> f;
};
Foo getFoo()
{
    return Foo();
}
int main()
{
    Foo b = getFoo();
}
which, I guess, makes sense. Foo is not copyable because future is not copyable.
 In function 'Foo getFoo()':
13:16: error: use of deleted function 'Foo::Foo(const Foo&)'
4:7: note: 'Foo::Foo(const Foo&)' is implicitly deleted because the default definition would be ill-formed:
4:7: error: use of deleted function 'std::future<_Res>::future(const std::future<_Res>&) [with _Res = int]'
In file included from 2:0:
/usr/include/c++/4.9/future:686:7: note: declared here
       future(const future&) = delete;
       ^
 In function 'int main()':
18:20: error: use of deleted function 'Foo::Foo(const Foo&)'
What I don't understand is why it compiles when I remove the destructor:
#include <future>
class Foo
{
public:
    //~Foo();
    std::future<int> f;
};
Foo getFoo()
{
    return Foo();
}
int main()
{
    Foo b = getFoo();
}
Isn't this destructor generated by default anyway? What effect does it have on the class being copyable/movable?
 
     
     
    