- 266
- 39
- CPU
- Ryzen 5 5600 @4.4GHz 1.27V
- Dissipatore
- Arctic Freezer 34 Esports Duo
- Scheda Madre
- ASUS Prime X570-P
- HDD
- S3+ 240GB, Crucial P3 1TB, WD Blue 1TB
- RAM
- Crucial Ballistix 4x8 3600MHz
- GPU
- Asus Dual RX 6600 8Gb
- Audio
- Sound Blaster Z
- Monitor
- AOC 24G2 Full HD 144Hz
- PSU
- Sharkoon WPM Gold Zero 550W
- Case
- Sharkoon S25-W (3x Deepcool FK120)
- Periferiche
- Fnatic React, Logitech G203, Rii Gaming RK900
- Net
- Fibra FTTC
- OS
- Windows 10 Pro 64bit
Ragazzi mi potete aiutare? Ho visto questo codice in c++ in cui viene fatta tramite una funzione templetizzata, una operazione di merging tra due mappe, però non riesco a capire a cosa serva quel dest.insert(it1, *it2) all'interno del secondo if.
Codice:
template<class Map, class Merger>
void merge(Map& dest, const Map& source, Merger merger)
{
auto it1 = dest.begin();
auto it2 = source.begin();
auto&& comp = dest.value_comp();
for (; it1 != dest.end() && it2 != source.end(); ) {
if (comp(*it1, *it2)) {
++it1;
} else if (comp(*it2, *it1)) {
dest.insert(it1, *it2);
++it2;
} else { // equivalent
it1->second = merger(it1->second, it2->second);
++it1;
++it2;
}
}
dest.insert(it2, source.end());
}
Ultima modifica da un moderatore: