summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common.hpp12
-rw-r--r--src/hir_typeck/static.hpp11
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);