Bläddra i källkod

change Ref<T> to allow non const access to ptr

allows non-const T* to be taken from const Ref<T> directly
instead of using hacky workarounds such as copying it to
another Ref

this fixes methods with const Ref<T>& arguments not being
able to access non-const methods on contained T
derammo 3 år sedan
förälder
incheckning
65116a7e91
1 ändrade filer med 3 tillägg och 14 borttagningar
  1. 3 14
      core/object/ref_counted.h

+ 3 - 14
core/object/ref_counted.h

@@ -97,26 +97,15 @@ public:
 		return reference != p_r.reference;
 		return reference != p_r.reference;
 	}
 	}
 
 
-	_FORCE_INLINE_ T *operator->() {
+	_FORCE_INLINE_ T *operator*() const {
 		return reference;
 		return reference;
 	}
 	}
 
 
-	_FORCE_INLINE_ T *operator*() {
+	_FORCE_INLINE_ T *operator->() const {
 		return reference;
 		return reference;
 	}
 	}
 
 
-	_FORCE_INLINE_ const T *operator->() const {
-		return reference;
-	}
-
-	_FORCE_INLINE_ const T *ptr() const {
-		return reference;
-	}
-	_FORCE_INLINE_ T *ptr() {
-		return reference;
-	}
-
-	_FORCE_INLINE_ const T *operator*() const {
+	_FORCE_INLINE_ T *ptr() const {
 		return reference;
 		return reference;
 	}
 	}