Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp] define extern for templated class #5824

Closed
ibilon opened this issue Nov 14, 2016 · 1 comment
Closed

[cpp] define extern for templated class #5824

ibilon opened this issue Nov 14, 2016 · 1 comment
Assignees
Labels
platform-cpp Everything related to CPP / C++

Comments

@ibilon
Copy link
Member

ibilon commented Nov 14, 2016

Trying to define an extern for a templated class.

For instance, std::vector (not specific to this class):

class Test {
    public static function main() {
        var i = cpp.Pointer.fromRaw(Vector.getIntVector());
        i.ptr.reserve(1);
        i.ptr.reserve(2);
    }
}

@:include("vector")
@:native("std::vector")
extern class Vector<T> {
    @:native("new std::vector<int>")
    public static function getIntVector() : cpp.RawPointer<Vector<Int>>;

    public function reserve(_:UInt) : Void;
}

gives:

./src/Test.cpp: In static member function ‘static void Test_obj::main()’:
./src/Test.cpp:29:55: error: type/value mismatch at argument 1 in template parameter list for ‘template<class T> class cpp::Pointer’
 HXLINE(   3)  HX_VARI( ::cpp::Pointer<  ::std::vector >,i) = ::cpp::Pointer_obj::fromRaw((new std::vector<int>()));

because

HX_VARI( ::cpp::Pointer<  ::std::vector >,i)

should be

HX_VARI( ::cpp::Pointer<  ::std::vector<int> >,i)
@Simn Simn added the platform-cpp Everything related to CPP / C++ label Nov 25, 2016
@Simn Simn modified the milestone: 4.0 Jan 9, 2017
@Simn Simn modified the milestones: Release 4.0, Bugs Apr 17, 2018
@Aidan63
Copy link
Contributor

Aidan63 commented Nov 7, 2022

Saw this searching for another issue, think its been solved by #10415

@Simn Simn closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-cpp Everything related to CPP / C++
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants