diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-12-29 06:44:48 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 13:44:48 +0100 |
commit | 732419ae907208b0b484911b996893097402a6c7 (patch) | |
tree | a69f23d7b67bade070941f3fa74a7068cf1d9153 | |
parent | d5a3c2c2da2e3b2f6deeb2c1cd5430db90bc4fd5 (diff) | |
download | Nim-732419ae907208b0b484911b996893097402a6c7.tar.gz |
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>
-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.} |