From b29783693c487603c8a0cfb43fc256c8a61d79f1 Mon Sep 17 00:00:00 2001 From: mantielero Date: Sat, 26 Nov 2022 22:24:53 +0100 Subject: [PATCH] added constructor --- cppstl/std_smartptrs.nim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cppstl/std_smartptrs.nim b/cppstl/std_smartptrs.nim index e94c5f0..de1fe90 100644 --- a/cppstl/std_smartptrs.nim +++ b/cppstl/std_smartptrs.nim @@ -9,6 +9,9 @@ when not defined(cpp): type CppSharedPtr*[T]{.importcpp: "std::shared_ptr", bycopy.} = object +proc newCppSharedPtr[T](p: ptr T): CppSharedPtr[T] {.constructor, + importcpp: "std::shared_ptr<'*0>(#)".} + func makeShared*(T: typedesc): CppSharedPtr[T] {.importcpp: "std::make_shared<'*0>()".} func makeShared*[T](p: CppSharedPtr[T]): CppSharedPtr[T] {.importcpp: "std::make_shared<'*0>(#)".}