mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-09 14:32:53 +00:00
fix #7653
This commit is contained in:
@@ -20,3 +20,19 @@ v.doSomething()
|
||||
|
||||
var vf = initVector[float]()
|
||||
vf.doSomething() # Nim uses doSomething[int] here in C++
|
||||
|
||||
# Alternative definition:
|
||||
# https://github.com/nim-lang/Nim/issues/7653
|
||||
|
||||
type VectorAlt* {.importcpp: "std::vector", header: "<vector>", nodecl.} [T] = object
|
||||
proc mkVector*[T]: VectorAlt[T] {.importcpp: "std::vector<'*0>()", header: "<vector>", constructor, nodecl.}
|
||||
|
||||
proc foo(): VectorAlt[cint] =
|
||||
mkVector[cint]()
|
||||
|
||||
proc bar(): VectorAlt[cstring] =
|
||||
mkVector[cstring]()
|
||||
|
||||
var x = foo()
|
||||
var y = bar()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user