get all elements without offset
This commit is contained in:
parent
0eedaeea3a
commit
c66972354a
@ -140,6 +140,14 @@ vector<FileSourceId> FileReferenceManager::get_some_file_sources(NodeId node_id)
|
||||
return it->second.file_source_ids.get_some_elements();
|
||||
}
|
||||
|
||||
vector<FileSourceId> FileReferenceManager::get_all_file_sources(NodeId node_id) {
|
||||
auto it = nodes_.find(node_id);
|
||||
if (it == nodes_.end()) {
|
||||
return {};
|
||||
}
|
||||
return it->second.file_source_ids.get_all_elements();
|
||||
}
|
||||
|
||||
vector<FullMessageId> FileReferenceManager::get_some_message_file_sources(NodeId node_id) {
|
||||
auto file_source_ids = get_some_file_sources(node_id);
|
||||
|
||||
@ -372,7 +380,7 @@ void FileReferenceManager::memory_cleanup() {
|
||||
auto remove = true;
|
||||
|
||||
while (file_nodes_it != nodes_.end() && remove) {
|
||||
auto elements = get_some_file_sources(file_nodes_it->first);
|
||||
auto elements = get_all_file_sources(file_nodes_it->first);
|
||||
auto elements_it = elements.begin();
|
||||
|
||||
while (elements_it != elements.end()) {
|
||||
|
@ -159,6 +159,8 @@ class FileReferenceManager : public Actor {
|
||||
template <class T>
|
||||
FileSourceId add_file_source_id(T source, Slice source_str);
|
||||
|
||||
vector<FileSourceId> FileReferenceManager::get_all_file_sources(NodeId node_id);
|
||||
|
||||
FileSourceId get_current_file_source_id() const;
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,14 @@ namespace td {
|
||||
template <class T>
|
||||
class FastSetWithPosition {
|
||||
public:
|
||||
std::vector<T> get_unchecked() const {
|
||||
std::vector<T> res;
|
||||
res.insert(res.end(), checked_.begin(), checked_.end());
|
||||
res.insert(res.end(), not_checked_.begin(), not_checked_.end());
|
||||
td::unique(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
std::vector<T> get_some_elements() const {
|
||||
std::vector<T> res;
|
||||
res.reserve(4);
|
||||
@ -106,6 +114,16 @@ class FastSetWithPosition {
|
||||
template <class T>
|
||||
class SetWithPosition {
|
||||
public:
|
||||
std::vector<T> get_all_elements() const {
|
||||
if (fast_) {
|
||||
return fast_->get_unchecked();
|
||||
}
|
||||
if (has_value_) {
|
||||
return {value_};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<T> get_some_elements() const {
|
||||
if (fast_) {
|
||||
return fast_->get_some_elements();
|
||||
|
Loading…
Reference in New Issue
Block a user