From: Carl N Baldwin Date: Tue, 18 Oct 2005 02:18:29 +0000 (-0600) Subject: Set differences now down X-Git-Tag: release-0.4~105 X-Git-Url: http://git.pippins.net/embedvideo/static/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/%7Blink_activity%7D?a=commitdiff_plain;h=302830c3b46d571d80b378fe91060a4a29e87d63;p=backups%2F.git Set differences now down --- diff --git a/main.cc b/main.cc index e07c7ee..c930155 100644 --- a/main.cc +++ b/main.cc @@ -28,6 +28,7 @@ vector split( const string &line, char c, int limit = -1 ) { return out; } +// Callback function for getting files from the database int populate_set( void *files_v, int, char **vals, char ** ) { file_set *files = reinterpret_cast( files_v ); files->insert( new FileData( vals[0][0], @@ -89,4 +90,26 @@ int main() { for( file_set::iterator i = previous_files.begin(); i != previous_files.end(); ++i ) { cout << (*i)->getFileName() << endl; } + + // Now divide the two sets into three sets (union and set differences) + FileDataPtrCmp cmp; + + file_set new_set; + set_difference( current_files.begin(), current_files.end(), + previous_files.begin(), previous_files.end(), + inserter( new_set, new_set.begin() ), + cmp ); + + file_set deleted_set; + set_difference( previous_files.begin(), previous_files.end(), + current_files.begin(), current_files.end(), + inserter( deleted_set, deleted_set.begin() ), + cmp ); + + // previous_files *should* definitely be the first set here + file_set common_set; + set_difference( previous_files.begin(), previous_files.end(), + current_files.begin(), current_files.end(), + inserter( common_set, common_set.begin() ), + cmp ); }