Skip to content

methods that return pointers from tracked memory are almost always size one #1964

@excaliburtb

Description

@excaliburtb
class Foo
{
public:

   double * get_vec()
   {
      return vec;
   }

protected:
    double vec[3];
};

from input.py

myvar = fooInstance.get_vec()
print(myvar)
print(myvar[0]) -- works
print(myvar[1]) -- doesn't work, fails with IndexError: Index out of range in swig_ref::__getitem__ error

i think the issue is due to the sole use of get_truncated_size. this seems to return the size relative to its containing class which will always result in a size of 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions