I want to write functions to add items. addItem and addItems each with a move variant. The latter accepts two input iterators. To add a single item I can overload the signature with rvalue references. But how do I overload a template function to work with move semantics?
void addItem(const shared_ptr<Item>& item, uint score) { // code that copies the shared_ptr… } void addItem(shared_ptr<Item>&& item, uint score) { // code that moves the shared_ptr… } template<typename Iterator> void addItems(Iterator begin, Iterator end) { /* * What to do here to take both move and normal iterators? * Since I cannot overload by signature I dont know how to * differentiate between move and non move iterators */ } Is it possible to have a single name for a function and to differentiate between the input iterators?
std::make_move_iterator?