Any suggestion on how to deal with std::vector ?

About Monkey 2 Forums Monkey 2 Programming Help Any suggestion on how to deal with std::vector ?

This topic contains 3 replies, has 3 voices, and was last updated by  Mark Sibly 1 year, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13316

    abakobo
    Participant

    I have the folowing cpp method that has the cpp11_std::vector type passed as reference

    int getFixturesByName(std::string name, std::vector<b2Fixture*>& fixtures);

    Any suggestion on how to deal with it (the vector part)?

    I plan to make a wrapper function with a “void ptr” as argument to point to the “b2Fixture” in order to pass an array.data address (using an array of classes). But I then have to check the sizeof and so on. Which seem a bit complex and I would be glad if there was any suggestion on how to deal with it more easily.

    thx

    #13330

    abakobo
    Participant

    I’ve finally used bbArray and it is way better than messing up with void casts.. (just had to #include “bbtypes” (in .h) and “bbarray” (in .cpp) in the native code, they were detected automatically)

    #13362

    cocon
    Participant

    Good idea for when making modules.

    #13370

    Mark Sibly
    Keymaster

    I recommend using #include <bbmonkey.h> if you want to access the native types in c++.

    There are GC issues you need to be a bit careful of too. I’ll try to write something up about this soon.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.