Given a data structure which has a user defined constructor taking a parameter, something like this:
struct Foo {
Foo() = default;
Foo(const int) {}
};
And given 2 vector
s of the same size: vector<int> input
and vector<Foo> output
. I'd like to be able to do this:
copy(cbegin(input), cend(input), begin(output))
Is there a way I can tell copy
or some other standard algorithm to construct a Foo
from the int
that is being iterated over?