2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Encapsulated DcOptions to an independent class.

This commit is contained in:
John Preston
2017-02-23 09:57:04 +03:00
parent 90b3b5c3e5
commit a35947141c
24 changed files with 606 additions and 329 deletions

View File

@@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "core/basic_types.h"
#include <array>
#include <algorithm>
namespace base {
@@ -82,6 +83,12 @@ scope_guard_helper<Lambda> scope_guard(Lambda on_scope_exit) {
return scope_guard_helper<Lambda>(std::move(on_scope_exit));
}
template <typename Container, typename T>
inline bool contains(const Container &container, const T &value) {
auto end = std::end(container);
return std::find(std::begin(container), end, value) != end;
}
} // namespace base
// using for_const instead of plain range-based for loop to ensure usage of const_iterator