Kaynağa Gözat

Fixed Variant.SetArrayElement with object arrays.

Mark Sibly 7 yıl önce
ebeveyn
işleme
593d588242
1 değiştirilmiş dosya ile 5 ekleme ve 16 silme
  1. 5 16
      modules/monkey/native/bbvariant.h

+ 5 - 16
modules/monkey/native/bbvariant.h

@@ -16,6 +16,7 @@ struct bbVariant{
 	template<class T,int D> static int _getArrayLength( bbArray<T,D> v ){ return v.length(); }
 	template<class T,int D> static bbVariant _getArrayElement( bbArray<T,D> v,int index );
 	template<class T,int D> static void _setArrayElement( bbArray<T,D> v,int index,bbVariant value );
+	template<class T,int D> static void _setArrayElement( bbArray<bbGCVar<T>,D> v,int index,bbVariant value );
  
 	struct RepBase{
 	
@@ -154,22 +155,6 @@ struct bbVariant{
 		return _ref<T>( 0 );
 	}
 
-	/*
-	template<class T> T *_ref( typename T::bb_object_type *p )const{
-		return get<T>();
-	}
-	
-	template<class T> T *_ref( T *p )const{
-		Rep<T> *r=dynamic_cast<Rep<T>*>( _rep );
-		if( !r ) bbRuntimeError( "Variant cast failed" );
-		return &r->value;
-	}
-	
-	template<class T> T *ref()const{
-		return _ref<T>( 0 );
-	}
-	*/
-	
 	bbTypeInfo *getType()const{
 		return _rep->getType();
 	}
@@ -216,4 +201,8 @@ template<class T,int D> void bbVariant::_setArrayElement( bbArray<T,D> v,int ind
 	v[index]=value.get<T>();
 }
 
+template<class T,int D> void bbVariant::_setArrayElement( bbArray<bbGCVar<T>,D> v,int index,bbVariant value ){
+	v[index]=value.get<T*>();
+}
+
 #endif