MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / PruneDestroyedAndSet

Function PruneDestroyedAndSet

Telegram/SourceFiles/data/data_streaming.cpp:24–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23template <typename Object, typename Data>
24bool PruneDestroyedAndSet(
25 base::flat_map<
26 not_null<Data*>,
27 std::weak_ptr<Object>> &objects,
28 not_null<Data*> data,
29 const std::shared_ptr<Object> &object) {
30 auto result = false;
31 for (auto i = begin(objects); i != end(objects);) {
32 if (i->first == data) {
33 (i++)->second = object;
34 result = true;
35 } else if (i->second.lock() != nullptr) {
36 ++i;
37 } else {
38 i = objects.erase(i);
39 }
40 }
41 return result;
42}
43
44[[nodiscard]] auto LookupOtherQualities(
45 DocumentData *original,

Callers 2

sharedReaderMethod · 0.85
sharedDocumentMethod · 0.85

Calls 2

lockMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected