I have a multimap with string as key and Cnode struct as the value:
struct Cnode
{
Cnode() : wtA(0), wtC(0), wtG(0), wtT(0) { }
Cnode(int newA, int newC, int newG, int newT)
: wtA(newA), wtC(newC), wtG(newG), wtT(newT)
{ }
int wtA, wtC, wtG, wtT;
};
Cnode combine_valuesA(const myFast map, const string& key)
{
return std::accumulate(
map.equal_range(key).first,
map.equal_range(key).second,
0,
[](int sumA, int sumC, int sumG, int sumT, myFast::value_type p) //error
{
return Cnode(
sumA + p.second.wtA,
sumC + p.second.wtC,
sumG + p.second.wtG,
sumT + p.second.wtT);
}
);
}
I need to add all the ints in Cnode for duplicate keys on the multimap. This is the error that I get:
No viable conversion from 'int' to 'Cnode'