mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
24 lines
386 B
Nim
24 lines
386 B
Nim
discard """
|
|
cmd: "nim cpp $file"
|
|
"""
|
|
|
|
{.emit: """
|
|
|
|
namespace System {
|
|
struct Input {};
|
|
}
|
|
|
|
struct SystemManager {
|
|
template <class T>
|
|
static T* getSubsystem() { return new T; }
|
|
};
|
|
|
|
""".}
|
|
|
|
type Input {.importcpp: "System::Input".} = object
|
|
proc getSubsystem*[T](): ptr T {.
|
|
importcpp: "SystemManager::getSubsystem<'*0>()", nodecl.}
|
|
|
|
let input: ptr Input = getSubsystem[Input]()
|
|
|