キーとして文字列、値としてCnode構造体を持つマルチマップがあります。
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);
}
);
}
マルチマップ上の重複キーのCnodeにすべてのintを追加する必要があります。これは私が得るエラーです:
'int'から'Cnode'への実行可能な変換はありません