I have a class template that wants to take an iterator type with an auto deduction from the constructor.
template <typename T>
struct Foo {
Foo(T a);
}
If I have the following, T will be std::vector<int>::iterator:
std::vector<int> vector;
auto I = vector.begin();
auto ptr = new Foo(I);
However, if I pass rvalue, T will be std::vector<int>::iterator&&
std::vector<int> vector;
auto ptr = new Foo(vector.begin());
How can I force each deduction to remove the &&? I simply just want to keep the iterator type where the copy is cheap.
Thanks.