RCTManagedPointer.mm 501 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import "RCTManagedPointer.h"
  8. @implementation RCTManagedPointer {
  9. std::shared_ptr<void> _pointer;
  10. }
  11. - (instancetype)initWithPointer:(std::shared_ptr<void>)pointer
  12. {
  13. if (self = [super init]) {
  14. _pointer = std::move(pointer);
  15. }
  16. return self;
  17. }
  18. - (void *)voidPointer
  19. {
  20. return _pointer.get();
  21. }
  22. @end