Skip to content

Commit

Permalink
Merge pull request #29 from mantielero/shared-ptr-constructor
Browse files Browse the repository at this point in the history
added constructor
  • Loading branch information
Clonkk authored Nov 28, 2022
2 parents 10b5185 + b297836 commit a5ff62d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cppstl/std_smartptrs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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>(#)".}
Expand Down

0 comments on commit a5ff62d

Please sign in to comment.