diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-07-20 14:33:01 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-07-20 14:33:01 +0800 |
commit | 4ffc42457c1265dfa6ee3bb2418f16ed4fd57fef (patch) | |
tree | b203b2cc6836ca7ade468818cc1a42a0e96fc8e2 /src | |
parent | 50c96bfab2b0bad4845a8a6beec096239a1840ab (diff) | |
download | mrust-4ffc42457c1265dfa6ee3bb2418f16ed4fd57fef.tar.gz |
HIR Typecheck - Move NullOnDrop to a common location
Diffstat (limited to 'src')
-rw-r--r-- | src/common.hpp | 12 | ||||
-rw-r--r-- | src/hir_typeck/static.hpp | 11 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/common.hpp b/src/common.hpp index 4cea1633..0363c334 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -412,5 +412,17 @@ RunIterable<T> runs(const ::std::vector<T>& x) { return RunIterable<T>(x); } +template<typename T> +class NullOnDrop { + T*& ptr; +public: + NullOnDrop(T*& ptr): + ptr(ptr) + {} + ~NullOnDrop() { + ptr = nullptr; + } +}; + #endif diff --git a/src/hir_typeck/static.hpp b/src/hir_typeck/static.hpp index 0d9449b1..652bad50 100644 --- a/src/hir_typeck/static.hpp +++ b/src/hir_typeck/static.hpp @@ -84,17 +84,6 @@ public: /// \brief State manipulation /// \{ - template<typename T> - class NullOnDrop { - T*& ptr; - public: - NullOnDrop(T*& ptr): - ptr(ptr) - {} - ~NullOnDrop() { - ptr = nullptr; - } - }; NullOnDrop<const ::HIR::GenericParams> set_impl_generics(const ::HIR::GenericParams& gps) { set_impl_generics_raw(gps); return NullOnDrop<const ::HIR::GenericParams>(m_impl_generics); |