Nim/tests/cpp/ttemplatetype.nim
flywind 732419ae90
improve examples in manual (#16497)
* improve examples in manual

* Update doc/manual.rst

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update tests/cpp/ttemplatetype.nim

Co-authored-by: Clyybber <darkmine956@gmail.com>

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-12-29 13:44:48 +01:00

13 lines
313 B
Nim

discard """
targets: "cpp"
"""
type
Map[T,U] {.importcpp: "std::map", header: "<map>".} = 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]()