I have a vector of pairs of characters, I want to initialize the first and last
pair with the first values of two other vectors of pairs of < char, float> called RFoL and RFoSL
so I got this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
//loops for RFoL
for(auto &c : RFoL){
//adds first char of RFoLtemporary char
keyMap.push_back(std::pair<char, char>( c.first, '-'));
}
int x = 0;
//loops for RFoSL and adds second value to keyMap
for(auto &c : RFoSL){
//adds temporary char
keyMap.at(x).second = c.first;
x++;
}
but I know there's a better way that's well ugly, something like this
or maybe some tasty lambdas, dont know how to write that beautiful, Im looking foward to revising for c++ exam, going to start right from the start again
ne555 is good enough for how im iterating, when ones longer than the other I stop anyway, to be clear, K is the size of each object and im iterating through them.
Thas nice code Duoas, im going to need to go through things like this, will have an exam on c++ in june!!