2017-08-14 15:47:46 +03:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-08-14 15:47:46 +03:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-08-14 15:47:46 +03:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace base {
|
|
|
|
|
2017-09-04 14:24:35 +03:00
|
|
|
template <typename Type>
|
|
|
|
inline Type take(Type &value) {
|
|
|
|
return std::exchange(value, Type {});
|
|
|
|
}
|
|
|
|
|
2017-11-23 13:58:12 +04:00
|
|
|
template <typename Type>
|
|
|
|
inline Type duplicate(const Type &value) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2017-09-04 14:24:35 +03:00
|
|
|
template <typename Type, size_t Size>
|
|
|
|
inline constexpr size_t array_size(const Type(&)[Size]) {
|
|
|
|
return Size;
|
|
|
|
}
|
|
|
|
|
2017-08-14 15:47:46 +03:00
|
|
|
} // namespace base
|