aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-03-03 01:42:24 +0100
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-03-29 23:29:47 +0200
commit916ab0195d567fd0a9097045e73a6654c453adea (patch)
treedc20ba5c27e9e923679288928da0e9277d258d0d /src/util
parent8dbb87a3932f81e23ba7afd865b9aeeb535f0c20 (diff)
downloadbitcoin-916ab0195d567fd0a9097045e73a6654c453adea.tar.xz
remove unused class util::Ref and its unit test
Diffstat (limited to 'src/util')
-rw-r--r--src/util/ref.h38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/util/ref.h b/src/util/ref.h
deleted file mode 100644
index 9685ea9fec..0000000000
--- a/src/util/ref.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2020 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_REF_H
-#define BITCOIN_UTIL_REF_H
-
-#include <util/check.h>
-
-#include <typeindex>
-
-namespace util {
-
-/**
- * Type-safe dynamic reference.
- *
- * This implements a small subset of the functionality in C++17's std::any
- * class, and can be dropped when the project updates to C++17
- * (https://github.com/bitcoin/bitcoin/issues/16684)
- */
-class Ref
-{
-public:
- Ref() = default;
- template<typename T> Ref(T& value) { Set(value); }
- template<typename T> T& Get() const { CHECK_NONFATAL(Has<T>()); return *static_cast<T*>(m_value); }
- template<typename T> void Set(T& value) { m_value = &value; m_type = std::type_index(typeid(T)); }
- template<typename T> bool Has() const { return m_value && m_type == std::type_index(typeid(T)); }
- void Clear() { m_value = nullptr; m_type = std::type_index(typeid(void)); }
-
-private:
- void* m_value = nullptr;
- std::type_index m_type = std::type_index(typeid(void));
-};
-
-} // namespace util
-
-#endif // BITCOIN_UTIL_REF_H