ソースを参照

Remove virtual inheritance from Pushable

Ole 9 年 前
コミット
568431e939
共有1 個のファイルを変更した5 個の追加13 個の削除を含む
  1. 5 13
      lib/luwra/types.hpp

+ 5 - 13
lib/luwra/types.hpp

@@ -456,7 +456,7 @@ namespace internal {
 /**
  * A value which may be pushed onto the stack.
  */
-struct Pushable: virtual internal::PushableI {
+struct Pushable {
 	internal::PushableI* interface;
 
 	template <typename T> inline
@@ -467,24 +467,16 @@ struct Pushable: virtual internal::PushableI {
 		other.interface = nullptr;
 	}
 
+	inline
 	Pushable(const Pushable& other): interface(other.interface->copy()) {}
 
-	virtual
-	size_t push(State* state) const {
-		return interface->push(state);
-	}
-
-	virtual
-	internal::PushableI* copy() const {
-		return new Pushable(*this);
-	}
-
-	virtual
+	inline
 	~Pushable() {
 		if (interface)
 			delete interface;
 	}
 
+	inline
 	bool operator <(const Pushable& other) const {
 		return interface < other.interface;
 	}
@@ -494,7 +486,7 @@ template <>
 struct Value<Pushable> {
 	static inline
 	size_t push(State* state, const Pushable& value) {
-		return value.push(state);
+		return value.interface->push(state);
 	}
 };