I have an object which is non-copyable and which requires an argument to its contructor:
class Foo
{
  public:
    Foo() = delete;
    Foo(const Foo &) = delete;
    Foo(int x);
  private:
    int member;
};
Foo::Foo(int x) : member(x)
{
}
I have another class which contains as a member an array of such objects:
class Bar
{
  public:
    Bar(int a);
  private:
    Foo members[4];
};
Suppose that my object Foo is really far too big and its constructor far too complicated for a temporary or duplicate copy to ever exist or the constructor to ever be called more than once for each item of the array.
How do I write the constructor for the containing class to pass the arguments to the items in the member array?
I have tried:
Bar::Bar(int a) : members { a, a+1, a+2, a+3 }
{
}
g++ says "use of deleted function Foo::Foo(const Foo&)".
[Edit] I have also tried:
Bar::Bar(int a) : members { {a}, {a+1}, {a+2}, {a+3} }
{
}
as suggested by Yksisarvinen.  This also says "use of deleted function Foo::Foo(const Foo&)", but only if I declare a destructor for Foo.  Without a destructor this compiles correctly.  How do I get it to compile for a class which has a destructor?
 
    