2 つのマップがあり、違いを見つけて、違いだけを持つ新しいマップを作成する必要があります。これを行う方法がわからない。set_difference を使用してみましたが、その仕組みがよくわかりません。どんな助けでも大歓迎です。ありがとう
// header file
typedef std::map<std::string, int> MapCol;
typedef std::map<std::string, MapCol> MapRow;
MapRow m_mapRows;
//.cpp fle
CheckForDifferences( const Table& rhs )
{
Table diffTable;
vector<string> v;
vector<string>::iterator it;
it=set_difference (m_mapRows.begin(), m_mapRows.end(), diffTable.m_mapRows.begin(), diffTable.m_mapRows.end, v.begin());
}
編集:
std::set_difference( m_mapRows.begin(), m_mapRows.end(),
rhs.m_mapRows.begin(), rhs.m_mapRows.end(), diffTable.m_mapRows.begin());
これは私が試したものですが、最初のエラーはエラー C2678: binary '=' : no operator found which takes a left-hand operand of type 'const std::string' (または受け入れ可能な変換がありません) です)
何か案は?