/
githubmirror
/
bitcoin
Обзор
Документация
Войти
/
githubmirror
/
bitcoin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/util/any.h
26 строк
673 B
MarcoFalke
scripted-diff: [doc] Unify stale copyright headers
17 дек 2025, 00:21
17 дек 2025, 00:21
fa5f297
Код
Авторство
О чём код?
// Copyright (c) 2023-present The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UTIL_ANY_H #define BITCOIN_UTIL_ANY_H #include <any> namespace util { /** * Helper function to access the contained object of a std::any instance. * Returns a pointer to the object if passed instance has a value and the type * matches, nullptr otherwise. */ template<typename T> T* AnyPtr(const std::any& any) noexcept { T* const* ptr = std::any_cast<T*>(&any); return ptr ? *ptr : nullptr; } } // namespace util #endif // BITCOIN_UTIL_ANY_H