samedi 3 juin 2017

merge 2 vectors using STL algorithm

I've 2 vectors, namely deals_all and deals_new of FXDeal, where FxDeal is a class

struct FxDeal
{
    int deal_id_; // primary key
    string ccy_pair_;
    double amount_;
}

How could I merge deals_new into deals_all so that

  • new deals in deals_new are copied or appended to deals_all, and
  • deals in deals_all that appear also in deal_new (by primary key deal_id_), will have field ccy_pair_ and amount_ updated

I'm using c++11.

Aucun commentaire:

Enregistrer un commentaire