[Help]in CWndFlyCoupon::ReOrderCouponVector()

04/18/2018 21:22 Barameu#1
in vs2017 i was stuck with this code.

[Only registered and activated users can see links. Click Here To Register...]

i never use make_pair before but if i was correct make_pair should be have 2 parameter for it ?

make_pair(x1,x2);

but <DWORD,CouponList> will can't complete in this function in vs2017 don't know why ?

:handsdown::handsdown:

finally i fix it
Code:
m_vecCouponList.push_back(std::make_pair(it->first, it->second));
-...-
04/19/2018 02:14 Avalion#2
std::make_pair<type, type> was changed to std::make_pair() as it takes type from values passed, in C++ 11

You can also do std::pair<type, type>(val, val) if you dont want to use std::make_pair.
04/19/2018 09:49 alfredico#3
You can alternatively use emplace or emplace_back. Instead getting the source to copy into the containers, it pass the parameters to the constructor of the object.
When using make_pair, a std::pair<a, b> is created and a copy of the pair is created, instead when using emplace/emplace_back a reference to the a and b object is done on the constructor of the value_type object.