From d1e04d376dfa01037b5671abe53f8fb841be9173 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 23 Oct 2011 12:58:19 +0000 Subject: RNA: fix collection iterator issue in c++ api with msvc. --- source/blender/makesrna/intern/makesrna.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 871cbad6152..42b78e3ff7e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2662,6 +2662,11 @@ static const char *cpp_classes = "" "class Array {\n" "public:\n" " T data[Tsize];\n" +"\n" +" Array() {}\n" +" Array(const Array& other) { memcpy(data, other.data, sizeof(T)*Tsize); }\n" +" const Array& operator=(const Array& other) { memcpy(data, other.data, sizeof(T)*Tsize); return *this; }\n" +"\n" " operator T*() { return data; }\n" "};\n" "\n" @@ -2678,8 +2683,6 @@ static const char *cpp_classes = "" " operator bool(void)\n" " { return iter.valid != 0; }\n" " const CollectionIterator& operator++() { Tnext(&iter); t = T(iter.ptr); return *this; }\n" -" const CollectionIterator& operator=(const CollectionIterator& copy)\n" -" { if(init) Tend(&iter); iter= copy.iter; if(iter.internal) iter.internal= MEM_dupallocN(iter.internal); t= copy.t; init= copy.init; return *this; }\n" "\n" " T& operator*(void) { return t; }\n" " T* operator->(void) { return &t; }\n" @@ -2690,6 +2693,8 @@ static const char *cpp_classes = "" " { if(init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n" "\n" "private:\n" +" const CollectionIterator& operator=(const CollectionIterator& copy) {}\n" +"" " CollectionPropertyIterator iter;\n" " T t;\n" " bool init;\n" @@ -2700,8 +2705,8 @@ static const char *cpp_classes = "" "public:\n" " Collection(const PointerRNA& p) : ptr(p) {}\n" "\n" -" CollectionIterator begin()\n" -" { CollectionIterator iter; iter.begin(ptr); return iter; }\n" +" void begin(CollectionIterator& iter)\n" +" { iter.begin(ptr); }\n" " CollectionIterator end()\n" " { return CollectionIterator(); } /* test */ \n" "\n" -- cgit v1.2.3