HaxeFoundation / HaxeFoundation/hxcpp

cpp.Star, does not have an overloaded member 'operator ->'

Open
#738 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
330
Forks
227
Avg merge
2d 16h
Merged PRs (30d)
18

Description

Hi there.
Got a strange thing with cpp.Star and externs.
Don't know why, but it trying to dereference pointer when I trying to access it's methods.

Did I miss something?

Here is Haxe code sample:
```haxe
package;
import cpp.Star;

class Test {
public static function main():Void {
var vec:Star = MyVector.createPtr();
vec.pushBack(new MyClass("Hello!"));
//trace(vec.at(0).val);
}
}

class MyClass {
public var val:String;
public function new(val:String) {
this.val = val;
}
}

@:native('std::vector')
extern class MyVector {
@:native('new std::vector') static function createPtr():Star;
@:native('push_back') public function pushBack(value:MyClass):Void;
public function at(index:Int):MyClass;
}
```

And here is how it generates:
```cpp
std::vector * vec = (new std::vector());
(*(vec))->push_back( ::MyClass_obj::__alloc( HX_CTX ,HX_("Hello!",ef,f0,df,38)));
//((vec))->push_back .... <<< but this expected
```

And error itself:
``` type 'std::vector>' does not have an overloaded member 'operator ->' ```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.