commit
d7e8b89eb8
3 changed files with 12 additions and 1 deletions
|
|
@ -654,7 +654,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var IntSet): Rope =
|
||||||
else:
|
else:
|
||||||
result = cppName & "<"
|
result = cppName & "<"
|
||||||
for i in 1 .. typ.len-2:
|
for i in 1 .. typ.len-2:
|
||||||
if i > 1: result.add(", ")
|
if i > 1: result.add(" COMMA ")
|
||||||
result.add(getTypeDescAux(m, typ.sons[i], check))
|
result.add(getTypeDescAux(m, typ.sons[i], check))
|
||||||
result.add("> ")
|
result.add("> ")
|
||||||
# always call for sideeffects:
|
# always call for sideeffects:
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,8 @@ __clang__
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#define COMMA ,
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
|
||||||
9
tests/cpp/ttemplatetype.nim
Normal file
9
tests/cpp/ttemplatetype.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
type
|
||||||
|
Map {.importcpp: "std::map", header: "<map>".} [T,U] = object
|
||||||
|
|
||||||
|
proc cInitMap(T: typedesc, U: typedesc): Map[T,U] {.importcpp: "std::map<'*1,'*2>()", nodecl.}
|
||||||
|
|
||||||
|
proc initMap[T, U](): Map[T, U] =
|
||||||
|
result = cInitMap(T, U)
|
||||||
|
|
||||||
|
var x: Map[cstring, cint] = initMap[cstring, cint]()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue