1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
Message: generated with roughly sed -i -r -e 's/std::erase_if/eraseIf/g' $( grep -l -riIE 'std::erase_if\(' )
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/afs/abstract_impl.h 10.18-2/FreeFileSync/Source/afs/abstract_impl.h
--- 10.18-1/FreeFileSync/Source/afs/abstract_impl.h 2019-11-20 16:15:55.823668066 -0500
+++ 10.18-2/FreeFileSync/Source/afs/abstract_impl.h 2019-11-20 17:57:30.555558350 -0500
@@ -255,7 +255,7 @@
pathLocks_.access([&](std::map<NativePath, std::weak_ptr<std::mutex>>& pathLocks)
{
//remove obsolete entries
- std::erase_if(pathLocks, [](const auto& v) { return !v.second.lock(); });
+ zen::eraseIf(pathLocks, [](const auto& v) { return !v.second.lock(); });
//get or create mutex
std::weak_ptr<std::mutex>& weakPtr = pathLocks[nativePath];
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-0/FreeFileSync/Source/afs/gdrive.cpp 10.19-1/FreeFileSync/Source/afs/gdrive.cpp
--- 10.18-0/FreeFileSync/Source/afs/gdrive.cpp 2019-11-20 16:15:55.828668123 -0500
+++ 10.19-1/FreeFileSync/Source/afs/gdrive.cpp 2019-12-27 11:17:35.793612360 -0500
@@ -1788,7 +1788,7 @@
if (auto it = itemDetails_.find(itemId); it != itemDetails_.end())
{
GoogleItemDetails detailsNew = it->second;
- std::erase_if(detailsNew.parentIds, [&](const std::string& id) { return id == parentIdOld; });
+ eraseIf(detailsNew.parentIds, [&](const std::string& id) { return id == parentIdOld; });
notifyItemUpdate(stateDelta, itemId, detailsNew);
}
else //conflict!!!
@@ -1802,7 +1802,7 @@
GoogleItemDetails detailsNew = it->second;
detailsNew.itemName = utfTo<std::string>(newName);
- std::erase_if(detailsNew.parentIds, [&](const std::string& id) { return id == parentIdFrom || id == parentIdTo; }); //
+ eraseIf(detailsNew.parentIds, [&](const std::string& id) { return id == parentIdFrom || id == parentIdTo; }); //
detailsNew.parentIds.push_back(parentIdTo); //not a duplicate
notifyItemUpdate(stateDelta, itemId, detailsNew);
@@ -1911,7 +1911,7 @@
return; //=> avoid misleading changeLog_ entries after Google Drive sync!!!
//update change logs (and clean up obsolete entries)
- std::erase_if(changeLog_, [&](std::weak_ptr<ItemIdDelta>& weakPtr)
+ eraseIf(changeLog_, [&](std::weak_ptr<ItemIdDelta>& weakPtr)
{
if (std::shared_ptr<ItemIdDelta> iid = weakPtr.lock())
{
@@ -1932,15 +1932,15 @@
std::vector<std::string> parentIdsNew = details->parentIds;
std::vector<std::string> parentIdsRemoved = it->second.parentIds;
- std::erase_if(parentIdsNew, [&](const std::string& id) { return std::find(it->second.parentIds.begin(), it->second.parentIds.end(), id) != it->second.parentIds.end(); });
- std::erase_if(parentIdsRemoved, [&](const std::string& id) { return std::find(details->parentIds.begin(), details->parentIds.end(), id) != details->parentIds.end(); });
+ eraseIf(parentIdsNew, [&](const std::string& id) { return std::find(it->second.parentIds.begin(), it->second.parentIds.end(), id) != it->second.parentIds.end(); });
+ eraseIf(parentIdsRemoved, [&](const std::string& id) { return std::find(details->parentIds.begin(), details->parentIds.end(), id) != details->parentIds.end(); });
for (const std::string& parentId : parentIdsNew)
folderContents_[parentId].childItems.push_back(it); //new insert => no need for duplicate check
for (const std::string& parentId : parentIdsRemoved)
if (auto itP = folderContents_.find(parentId); itP != folderContents_.end())
- std::erase_if(itP->second.childItems, [&](auto itChild) { return itChild == it; });
+ eraseIf(itP->second.childItems, [&](auto itChild) { return itChild == it; });
//if all parents are removed, Google Drive will (recursively) delete the item => don't prematurely do this now: wait for change notifications!
it->second = *details;
@@ -1959,7 +1959,7 @@
{
for (const std::string& parentId : it->second.parentIds) //1. delete from parent folders
if (auto itP = folderContents_.find(parentId); itP != folderContents_.end())
- std::erase_if(itP->second.childItems, [&](auto itChild) { return itChild == it; });
+ eraseIf(itP->second.childItems, [&](auto itChild) { return itChild == it; });
itemDetails_.erase(it);
}
@@ -1967,7 +1967,7 @@
if (auto itP = folderContents_.find(itemId); itP != folderContents_.end())
{
for (auto itChild : itP->second.childItems) //2. delete as parent from child items (don't wait for change notifications of children)
- std::erase_if(itChild->second.parentIds, [&](const std::string& id) { return id == itemId; });
+ eraseIf(itChild->second.parentIds, [&](const std::string& id) { return id == itemId; });
folderContents_.erase(itP);
}
}
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/afs/sftp.cpp 10.18-2/FreeFileSync/Source/afs/sftp.cpp
--- 10.18-1/FreeFileSync/Source/afs/sftp.cpp 2019-11-20 17:54:23.078438037 -0500
+++ 10.18-2/FreeFileSync/Source/afs/sftp.cpp 2019-11-20 17:57:30.557558372 -0500
@@ -946,7 +946,7 @@
std::this_thread::yield();
return; //don't hold lock for too long: delete only one session at a time, then yield...
}
- std::erase_if(sessions.sshSessionsWithThreadAffinity, [](const auto& v) { return !v.second.lock(); }); //clean up dangling weak pointer
+ eraseIf(sessions.sshSessionsWithThreadAffinity, [](const auto& v) { return !v.second.lock(); }); //clean up dangling weak pointer
done = true;
});
}
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/base/algorithm.cpp 10.18-2/FreeFileSync/Source/base/algorithm.cpp
--- 10.18-1/FreeFileSync/Source/base/algorithm.cpp 2019-11-20 16:15:55.832668168 -0500
+++ 10.18-2/FreeFileSync/Source/base/algorithm.cpp 2019-11-20 17:57:30.558558384 -0500
@@ -1372,8 +1372,8 @@
{
std::vector<const FileSystemObject*> itemSelectionLeft (rowsToCopyOnLeft .begin(), rowsToCopyOnLeft .end());
std::vector<const FileSystemObject*> itemSelectionRight(rowsToCopyOnRight.begin(), rowsToCopyOnRight.end());
- std::erase_if(itemSelectionLeft, [](const FileSystemObject* fsObj) { return fsObj->isEmpty< LEFT_SIDE>(); }); //needed for correct stats!
- std::erase_if(itemSelectionRight, [](const FileSystemObject* fsObj) { return fsObj->isEmpty<RIGHT_SIDE>(); }); //
+ eraseIf(itemSelectionLeft, [](const FileSystemObject* fsObj) { return fsObj->isEmpty< LEFT_SIDE>(); }); //needed for correct stats!
+ eraseIf(itemSelectionRight, [](const FileSystemObject* fsObj) { return fsObj->isEmpty<RIGHT_SIDE>(); }); //
const int itemTotal = static_cast<int>(itemSelectionLeft.size() + itemSelectionRight.size());
int64_t bytesTotal = 0;
@@ -1548,8 +1548,8 @@
std::vector<FileSystemObject*> deleteLeft = rowsToDeleteOnLeft;
std::vector<FileSystemObject*> deleteRight = rowsToDeleteOnRight;
- std::erase_if(deleteLeft, [](const FileSystemObject* fsObj) { return fsObj->isEmpty< LEFT_SIDE>(); }); //needed?
- std::erase_if(deleteRight, [](const FileSystemObject* fsObj) { return fsObj->isEmpty<RIGHT_SIDE>(); }); //yes, for correct stats:
+ eraseIf(deleteLeft, [](const FileSystemObject* fsObj) { return fsObj->isEmpty< LEFT_SIDE>(); }); //needed?
+ eraseIf(deleteRight, [](const FileSystemObject* fsObj) { return fsObj->isEmpty<RIGHT_SIDE>(); }); //yes, for correct stats:
const int itemCount = static_cast<int>(deleteLeft.size() + deleteRight.size());
callback.initNewPhase(itemCount, 0, ProcessPhase::none); //throw X
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/base/db_file.cpp 10.18-2/FreeFileSync/Source/base/db_file.cpp
--- 10.18-1/FreeFileSync/Source/base/db_file.cpp 2019-11-20 16:15:55.836668213 -0500
+++ 10.18-2/FreeFileSync/Source/base/db_file.cpp 2019-11-20 17:57:30.559558395 -0500
@@ -591,7 +591,7 @@
}
//delete removed items (= "in-sync") from database
- std::erase_if(dbFiles, [&](const InSyncFolder::FileList::value_type& v)
+ eraseIf(dbFiles, [&](const InSyncFolder::FileList::value_type& v)
{
if (contains(toPreserve, v.first))
return false;
@@ -628,7 +628,7 @@
}
//delete removed items (= "in-sync") from database
- std::erase_if(dbSymlinks, [&](const InSyncFolder::SymlinkList::value_type& v)
+ eraseIf(dbSymlinks, [&](const InSyncFolder::SymlinkList::value_type& v)
{
if (contains(toPreserve, v.first))
return false;
@@ -663,7 +663,7 @@
}
//delete removed items (= "in-sync") from database
- std::erase_if(dbFolders, [&](InSyncFolder::FolderList::value_type& v)
+ eraseIf(dbFolders, [&](InSyncFolder::FolderList::value_type& v)
{
if (auto it = toPreserve.find(v.first); it != toPreserve.end())
{
@@ -687,10 +687,10 @@
//delete all entries for removed folder (= "in-sync") from database
void dbSetEmptyState(InSyncFolder& dbFolder, const Zstring& parentRelPathPf)
{
- std::erase_if(dbFolder.files, [&](const InSyncFolder::FileList ::value_type& v) { return filter_.passFileFilter(parentRelPathPf + v.first); });
- std::erase_if(dbFolder.symlinks, [&](const InSyncFolder::SymlinkList::value_type& v) { return filter_.passFileFilter(parentRelPathPf + v.first); });
+ eraseIf(dbFolder.files, [&](const InSyncFolder::FileList ::value_type& v) { return filter_.passFileFilter(parentRelPathPf + v.first); });
+ eraseIf(dbFolder.symlinks, [&](const InSyncFolder::SymlinkList::value_type& v) { return filter_.passFileFilter(parentRelPathPf + v.first); });
- std::erase_if(dbFolder.folders, [&](InSyncFolder::FolderList::value_type& v)
+ eraseIf(dbFolder.folders, [&](InSyncFolder::FolderList::value_type& v)
{
const Zstring& itemRelPath = parentRelPathPf + v.first;
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/base/dir_lock.cpp 10.18-2/FreeFileSync/Source/base/dir_lock.cpp
--- 10.18-1/FreeFileSync/Source/base/dir_lock.cpp 2019-11-20 16:15:55.836668213 -0500
+++ 10.18-2/FreeFileSync/Source/base/dir_lock.cpp 2019-11-20 17:57:30.559558395 -0500
@@ -502,8 +502,8 @@
void tidyUp() //remove obsolete entries
{
- std::erase_if(locksByGuid_, [](const auto& v) { return !v.second.lock(); });
- std::erase_if(guidByPath_, [&](const auto& v) { return !contains(locksByGuid_, v.second); });
+ eraseIf(locksByGuid_, [](const auto& v) { return !v.second.lock(); });
+ eraseIf(guidByPath_, [&](const auto& v) { return locksByGuid_.find(v.second) == locksByGuid_.end(); });
}
std::map<Zstring, UniqueId> guidByPath_; //lockFilePath |-> GUID; n:1; locks can be referenced by a lockFilePath or alternatively a GUID
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/RealTimeSync/config.cpp 10.18-2/FreeFileSync/Source/RealTimeSync/config.cpp
--- 10.18-1/FreeFileSync/Source/RealTimeSync/config.cpp 2019-11-20 16:15:55.820668033 -0500
+++ 10.18-2/FreeFileSync/Source/RealTimeSync/config.cpp 2019-11-20 17:57:30.559558395 -0500
@@ -155,7 +155,7 @@
checkXmlMappingErrors(in, filePath); //throw FileError
//---------------------------------------------------------------------------------------
- std::erase_if(uniqueFolders, [](const Zstring& str) { return trimCpy(str).empty(); });
+ eraseIf(uniqueFolders, [](const Zstring& str) { return trimCpy(str).empty(); });
cfg.directories.assign(uniqueFolders.begin(), uniqueFolders.end());
cfg.commandline = Zstr('"') + fff::getFreeFileSyncLauncherPath() + Zstr("\" \"") + filePath + Zstr('"');
}
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/RealTimeSync/monitor.cpp 10.18-2/FreeFileSync/Source/RealTimeSync/monitor.cpp
--- 10.18-1/FreeFileSync/Source/RealTimeSync/monitor.cpp 2019-11-20 16:15:55.822668055 -0500
+++ 10.18-2/FreeFileSync/Source/RealTimeSync/monitor.cpp 2019-11-20 17:57:30.560558406 -0500
@@ -163,7 +163,7 @@
{
std::vector<DirWatcher::Entry> changedItems = watcher->getChanges([&] { requestUiUpdate(false /*readyForSync*/); /*throw X*/ },
cbInterval); //throw FileError
- std::erase_if(changedItems, [](const DirWatcher::Entry& e)
+ eraseIf(changedItems, [](const DirWatcher::Entry& e)
{
return
endsWith(e.itemPath, Zstr(".ffs_tmp")) || //sync.8ea2.ffs_tmp
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/RealTimeSync/tray_menu.cpp 10.18-2/FreeFileSync/Source/RealTimeSync/tray_menu.cpp
--- 10.18-1/FreeFileSync/Source/RealTimeSync/tray_menu.cpp 2019-11-20 16:15:55.822668055 -0500
+++ 10.18-2/FreeFileSync/Source/RealTimeSync/tray_menu.cpp 2019-11-20 17:57:30.560558406 -0500
@@ -247,7 +247,7 @@
rts::AbortReason rts::runFolderMonitor(const XmlRealConfig& config, const wxString& jobname)
{
std::vector<Zstring> dirNamesNonFmt = config.directories;
- std::erase_if(dirNamesNonFmt, [](const Zstring& str) { return trimCpy(str).empty(); }); //remove empty entries WITHOUT formatting paths yet!
+ eraseIf(dirNamesNonFmt, [](const Zstring& str) { return trimCpy(str).empty(); }); //remove empty entries WITHOUT formatting paths yet!
if (dirNamesNonFmt.empty())
{
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/ui/cfg_grid.cpp 10.18-2/FreeFileSync/Source/ui/cfg_grid.cpp
--- 10.18-1/FreeFileSync/Source/ui/cfg_grid.cpp 2019-11-20 16:15:55.847668337 -0500
+++ 10.18-2/FreeFileSync/Source/ui/cfg_grid.cpp 2019-11-20 17:57:30.561558418 -0500
@@ -113,7 +113,7 @@
{
const std::set<Zstring, LessNativePath> pathsSorted(filePaths.begin(), filePaths.end());
- std::erase_if(cfgListView_, [&](auto it) { return pathsSorted.find(it->first) != pathsSorted.end(); });
+ eraseIf(cfgListView_, [&](auto it) { return pathsSorted.find(it->first) != pathsSorted.end(); });
for (const Zstring& filePath : filePaths)
cfgList_.erase(filePath);
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/ui/command_box.cpp 10.18-2/FreeFileSync/Source/ui/command_box.cpp
--- 10.18-1/FreeFileSync/Source/ui/command_box.cpp 2019-11-20 17:54:14.861345102 -0500
+++ 10.18-2/FreeFileSync/Source/ui/command_box.cpp 2019-11-20 17:57:30.561558418 -0500
@@ -75,7 +75,7 @@
equalNoCase(newCommand, cmd))
return;
- std::erase_if(history_, [&](const Zstring& item) { return equalNoCase(newCommand, item); });
+ eraseIf(history_, [&](const Zstring& item) { return equalNoCase(newCommand, item); });
history_.insert(history_.begin(), newCommand);
@@ -194,7 +194,7 @@
//this->SetSelection(wxNOT_FOUND);
//delete selected row
- std::erase_if(history_, [&](const Zstring& item) { return item == selValue; });
+ eraseIf(history_, [&](const Zstring& item) { return item == selValue; });
SetString(pos, wxString()); //in contrast to Delete(), this one does not kill the drop-down list and gives a nice visual feedback!
//Delete(pos);
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/ui/file_view.cpp 10.18-2/FreeFileSync/Source/ui/file_view.cpp
--- 10.18-1/FreeFileSync/Source/ui/file_view.cpp 2019-11-20 16:15:55.849668360 -0500
+++ 10.18-2/FreeFileSync/Source/ui/file_view.cpp 2019-11-20 17:57:30.562558429 -0500
@@ -253,7 +253,7 @@
rowPositionsFirstChild_.clear();
//remove rows that have been deleted meanwhile
- std::erase_if(sortedRef_, [&](const RefIndex& refIdx) { return !FileSystemObject::retrieve(refIdx.objId); });
+ eraseIf(sortedRef_, [&](const RefIndex& refIdx) { return !FileSystemObject::retrieve(refIdx.objId); });
}
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/ui/folder_history_box.h 10.18-2/FreeFileSync/Source/ui/folder_history_box.h
--- 10.18-1/FreeFileSync/Source/ui/folder_history_box.h 2019-11-20 16:15:55.849668360 -0500
+++ 10.18-2/FreeFileSync/Source/ui/folder_history_box.h 2019-11-20 17:57:30.562558429 -0500
@@ -35,13 +35,13 @@
const Zstring nameTmp = zen::trimCpy(folderPathPhrase);
//insert new folder or put it to the front if already existing
- std::erase_if(folderPathPhrases_, [&](const Zstring& item) { return equalNoCase(item, nameTmp); });
+ zen::eraseIf(folderPathPhrases_, [&](const Zstring& item) { return equalNoCase(item, nameTmp); });
folderPathPhrases_.insert(folderPathPhrases_.begin(), nameTmp);
truncate();
}
- void delItem(const Zstring& folderPathPhrase) { std::erase_if(folderPathPhrases_, [&](const Zstring& item) { return equalNoCase(item, folderPathPhrase); }); }
+ void delItem(const Zstring& folderPathPhrase) { zen::eraseIf(folderPathPhrases_, [&](const Zstring& item) { return equalNoCase(item, folderPathPhrase); }); }
private:
void truncate()
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/ui/log_panel.cpp 10.18-2/FreeFileSync/Source/ui/log_panel.cpp
--- 10.18-1/FreeFileSync/Source/ui/log_panel.cpp 2019-11-20 16:15:55.852668394 -0500
+++ 10.18-2/FreeFileSync/Source/ui/log_panel.cpp 2019-11-20 17:57:30.562558429 -0500
@@ -545,7 +545,7 @@
if (auto prov = m_gridMessages->getDataProvider())
{
std::vector<Grid::ColAttributes> colAttr = m_gridMessages->getColumnConfig();
- std::erase_if(colAttr, [](const Grid::ColAttributes& ca) { return !ca.visible; });
+ eraseIf(colAttr, [](const Grid::ColAttributes& ca) { return !ca.visible; });
if (!colAttr.empty())
for (size_t row : m_gridMessages->getSelectedRows())
{
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/ui/main_dlg.cpp 10.18-2/FreeFileSync/Source/ui/main_dlg.cpp
--- 10.18-1/FreeFileSync/Source/ui/main_dlg.cpp 2019-11-20 17:54:16.135359512 -0500
+++ 10.18-2/FreeFileSync/Source/ui/main_dlg.cpp 2019-11-20 17:57:30.564558452 -0500
@@ -1240,7 +1240,7 @@
if (auto prov = grid->getDataProvider())
{
std::vector<Grid::ColAttributes> colAttr = grid->getColumnConfig();
- std::erase_if(colAttr, [](const Grid::ColAttributes& ca) { return !ca.visible; });
+ eraseIf(colAttr, [](const Grid::ColAttributes& ca) { return !ca.visible; });
if (!colAttr.empty())
for (size_t row : grid->getSelectedRows())
{
@@ -5372,9 +5372,9 @@
auto colAttrCenter = m_gridMainC->getColumnConfig();
auto colAttrRight = m_gridMainR->getColumnConfig();
- std::erase_if(colAttrLeft, [](const Grid::ColAttributes& ca) { return !ca.visible; });
- std::erase_if(colAttrCenter, [](const Grid::ColAttributes& ca) { return !ca.visible || static_cast<ColumnTypeCenter>(ca.type) == ColumnTypeCenter::CHECKBOX; });
- std::erase_if(colAttrRight, [](const Grid::ColAttributes& ca) { return !ca.visible; });
+ eraseIf(colAttrLeft, [](const Grid::ColAttributes& ca) { return !ca.visible; });
+ eraseIf(colAttrCenter, [](const Grid::ColAttributes& ca) { return !ca.visible || static_cast<ColumnTypeCenter>(ca.type) == ColumnTypeCenter::CHECKBOX; });
+ eraseIf(colAttrRight, [](const Grid::ColAttributes& ca) { return !ca.visible; });
if (provLeft && provCenter && provRight)
{
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/ui/search_grid.cpp 10.18-2/FreeFileSync/Source/ui/search_grid.cpp
--- 10.18-1/FreeFileSync/Source/ui/search_grid.cpp 2019-11-20 16:15:55.855668428 -0500
+++ 10.18-2/FreeFileSync/Source/ui/search_grid.cpp 2019-11-20 17:57:30.564558452 -0500
@@ -69,7 +69,7 @@
if (auto prov = grid.getDataProvider())
{
std::vector<Grid::ColAttributes> colAttr = grid.getColumnConfig();
- std::erase_if(colAttr, [](const Grid::ColAttributes& ca) { return !ca.visible; });
+ eraseIf(colAttr, [](const Grid::ColAttributes& ca) { return !ca.visible; });
if (!colAttr.empty())
{
const MatchFound<respectCase> matchFound(searchString);
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/ui/tree_grid.cpp 10.18-2/FreeFileSync/Source/ui/tree_grid.cpp
--- 10.18-1/FreeFileSync/Source/ui/tree_grid.cpp 2019-11-20 16:15:55.858668462 -0500
+++ 10.18-2/FreeFileSync/Source/ui/tree_grid.cpp 2019-11-20 17:57:30.565558463 -0500
@@ -601,7 +601,7 @@
folderCmp_ = newData;
//remove truly empty folder pairs as early as this: we want to distinguish single/multiple folder pair cases by looking at "folderCmp"
- std::erase_if(folderCmp_, [](const std::shared_ptr<BaseFolderPair>& baseObj)
+ eraseIf(folderCmp_, [](const std::shared_ptr<BaseFolderPair>& baseObj)
{
return AFS::isNullPath(baseObj->getAbstractPath< LEFT_SIDE>()) &&
AFS::isNullPath(baseObj->getAbstractPath<RIGHT_SIDE>());
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/wx+/async_task.h 10.18-2/wx+/async_task.h
--- 10.18-1/wx+/async_task.h 2019-11-20 16:15:55.860668484 -0500
+++ 10.18-2/wx+/async_task.h 2019-11-20 17:57:30.565558463 -0500
@@ -85,7 +85,7 @@
std::vector<std::unique_ptr<Task>> readyTasks; //Reentrancy; access to AsyncTasks::add is not protected! => evaluate outside eraseIf
- std::erase_if(tasks_, [&](std::unique_ptr<Task>& task)
+ eraseIf(tasks_, [&](std::unique_ptr<Task>& task)
{
if (task->resultReady())
{
diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/zen/stl_tools.h 10.18-2/zen/stl_tools.h
--- 10.18-1/zen/stl_tools.h 2019-11-20 16:15:55.875668653 -0500
+++ 10.18-2/zen/stl_tools.h 2019-11-20 17:58:20.801126674 -0500
@@ -20,6 +20,16 @@
//enhancements for <algorithm>
namespace zen
{
+//erase selected elements from any container:
+template <class T, class Alloc, class Predicate>
+void eraseIf(std::vector<T, Alloc>& v, Predicate p);
+
+template <class T, class LessType, class Alloc, class Predicate>
+void eraseIf(std::set<T, LessType, Alloc>& s, Predicate p);
+
+template <class KeyType, class ValueType, class LessType, class Alloc, class Predicate>
+void eraseIf(std::map<KeyType, ValueType, LessType, Alloc>& m, Predicate p);
+
//append STL containers
template <class T, class Alloc, class C>
void append(std::vector<T, Alloc>& v, const C& c);
@@ -115,6 +125,36 @@
//######################## implementation ########################
+
+template <class T, class Alloc, class Predicate> inline
+void eraseIf(std::vector<T, Alloc>& v, Predicate p)
+{
+ v.erase(std::remove_if(v.begin(), v.end(), p), v.end());
+}
+
+
+namespace impl
+{
+template <class S, class Predicate> inline
+void setOrMapEraseIf(S& s, Predicate p)
+{
+ for (auto it = s.begin(); it != s.end();)
+ if (p(*it))
+ s.erase(it++);
+ else
+ ++it;
+}
+}
+
+
+template <class T, class LessType, class Alloc, class Predicate> inline
+void eraseIf(std::set<T, LessType, Alloc>& s, Predicate p) { impl::setOrMapEraseIf(s, p); } //don't make this any more generic! e.g. must not compile for std::vector!!!
+
+
+template <class KeyType, class ValueType, class LessType, class Alloc, class Predicate> inline
+void eraseIf(std::map<KeyType, ValueType, LessType, Alloc>& m, Predicate p) { impl::setOrMapEraseIf(m, p); }
+
+
template <class T, class Alloc, class C> inline
void append(std::vector<T, Alloc>& v, const C& c) { v.insert(v.end(), c.begin(), c.end()); }
|