this is the declaration of "emplace":
template <class... Args>
iterator emplace (const_iterator position, Args&&... args);
so i wonder if i can pass multiple parameters to emplace and write the code below.
1 2 3 4 5 6 7
//necessary headfiles are included
int main(){
vector<int> coll({1,4,5,6});
coll.emplace(coll.begin(),2,3,5);
print(coll);//a function that cout each elements of "coll"
return 0;
}
It finally gets wrong.But when i change the parameters likes that:
coll.emplace(coll.begin(),2);
It works. I wonder what is the meaning of"...args" at the declaraion?If it is a variadic template,why can't i pass mutiple numbers to "coll"?What's the wrong with my code?
Apperciate it if you can do me a favour.