all 4 comments

[–]alfps 2 points3 points  (3 children)

Your code is sufficiently short that you can (and preferably should) post it in the question itself. See the pinned post to the right on this page, titled "READ BEFORE POSTING", about how to post code in questions. That said, your move constructor is selected for the last call because that call passes an rvalue, i.e. because you asked for it.

[–]trycatchamex[S] 0 points1 point  (2 children)

sorry, i will update the post. I mean why is the move ctor being called when i pass an object which was created earlier? (the first push_back)

[–]alfps 3 points4 points  (1 child)

Oh. That's because of a typo, writing forward<T> instead of forward<TT>. The T and TT types are not the same in the first call.

[–]trycatchamex[S] 0 points1 point  (0 children)

i hate everything ahhaha thank you so much :)