diff options
-rw-r--r-- | doc/manual.rst | 4 | ||||
-rw-r--r-- | tests/cpp/ttemplatetype.nim | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/manual.rst b/doc/manual.rst index fd0ac0529..9fabee1e8 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -7062,8 +7062,10 @@ one can import C++'s templates rather easily without the need for a pattern language for object types: .. code-block:: nim + :test: "nim cpp $1" + type - StdMap {.importcpp: "std::map", header: "<map>".} [K, V] = object + StdMap[K, V] {.importcpp: "std::map", header: "<map>".} = object proc `[]=`[K, V](this: var StdMap[K, V]; key: K; val: V) {. importcpp: "#[#] = #", header: "<map>".} diff --git a/tests/cpp/ttemplatetype.nim b/tests/cpp/ttemplatetype.nim index ef24e4cdc..bf243ac43 100644 --- a/tests/cpp/ttemplatetype.nim +++ b/tests/cpp/ttemplatetype.nim @@ -3,7 +3,7 @@ discard """ """ type - Map {.importcpp: "std::map", header: "<map>".} [T,U] = object + Map[T,U] {.importcpp: "std::map", header: "<map>".} = object proc cInitMap(T: typedesc, U: typedesc): Map[T,U] {.importcpp: "std::map<'*1,'*2>()", nodecl.} |