Re: [C++] Store a structure of vector in a UserData

2013-06-12 Thread Ahmidou Lyazidi
Thanks for the example, I'll try tonight! I also started to mockup a simple version, and surprise, it's working.. I'll keep you informed if I find where the problem is. Cheers --- Ahmidou Lyazidi Director | TD | CG artist

Re: [C++] Store a structure of vector in a UserData

2013-06-10 Thread Ahmidou Lyazidi
Thanks everyone, unfortunatly I'm still stuck. @ Stephane, this is what I'm doing, but it's not working: sizeof( test.A ) + sizeof( double ) * test.A.size() + sizeof( test.B ) + sizeof( double ) * test.B.size() + sizeof( bool ) * 2 @ Guillame Thanks, I tryed your example but I'm probably

Re: [C++] Store a structure of vector in a UserData

2013-06-10 Thread Guillaume Laforge
Hi Ahmidou, I'm often storing just a pointer to an array/buffer/vector to pass any struct to a User Data and it is working fine. It is hard to help you without seeing more chunks of your code :). Maybe you could try to repro the issue on a simpler code that you could share here ? Cheers,

[C++] Store a structure of vector in a UserData

2013-06-09 Thread Ahmidou Lyazidi
Hi List, Is it possible to store this kind of struct in a UserData (map or blob): struct Foo{ std::vectordouble A; std::vectordouble B; bool C; bool D; }; I can pull out the structure, and the vectors have the good number of item...but they are empty, the values are gone I'm not

Re: [C++] Store a structure of vector in a UserData

2013-06-09 Thread Guillaume Laforge
Hi Ahmidou :), You could try to use pointers to std::vector. This way you will be able to access those vector and get the double values correctly. But you must handle the allocation/deallocation of those vectors by yourself: struct Foo{ std::vectordouble *A; std::vectordouble *B;

Re: [C++] Store a structure of vector in a UserData

2013-06-09 Thread Stephan Woermann
To get the total size of the struct, this should work: Foo test; sizeof( double ) * test.A.size() + sizeof( double ) * test.B.size() + sizeof( bool ) * 2 Stephan 2013/6/9 Guillaume Laforge guillaume.laforge...@gmail.com Hi Ahmidou :), You could try to use pointers to std::vector. This way

RE: [C++] Store a structure of vector in a UserData

2013-06-09 Thread Marc-Andre Belzile
Alternatively, you could store C++ buffers in your struct instead of std::vector objects. Then if you need to access your data with stl, just assign each buffer to an std::vector out from these buffers. If you can't afford the extra copy performed by std::vector constructor, you'll need to