I wish to create an object A that can be constructed by either copying or moving a variable number of B objects. Something like this:
class B {}
class A {
A(B&& operand1, B&& operand2, ... B&& operandk) {
// move construct A
}
A(B& operand1, B& operand2, ... B& operandk) {
// copy construct B
}
}
I can't seem to identify a way to store r-value references in any sort of iterable container to accomplish this. I've read about std::reference_wrapper
but it doesn't seem to allow for r-values. Is there a way to accomplish something like this, or is there a reason I shouldn't be trying to do this at all? Thanks very much.