Like so:
std::tuple<A> t(1);
A
's move constructor isn't implicitly declared since you delete
d the copy constructor (which should take an A const&
btw), so the form you're trying to use wouldn't be valid outside of tuple
anyway:
A a = A(1); // error
If you need a move constructor, you'll need to explicitly write one:
A(A&& rhs) = default;
at which point this would work:
std::tuple<A> t(A(1));
Note that the forward
is redundant since A(1)
is already an rvalue.
I can't modify the class A
in any manner.
Given that, you cannot make a std::tuple<A>
. The member int
is private, so you can't access it to use the int
constructor like I initially proposed. There is no move constructor, so you can't use that one either. Those were your two options - neither of which are apparently viable.
Moreover, you cannot even make a std::tuple<std::shared_ptr<A>>
since again A
is noncopyable and you have no way to get at the int
member.
Game over, man. Game over.