Skip to content

Commit

Permalink
RCTManagedPointer fix ups
Browse files Browse the repository at this point in the history
Reviewed By: javache

Differential Revision: D5727367

fbshipit-source-id: ef6c03e57ee0c40da9411c77f0e8a733945afa07
  • Loading branch information
fromcelticpark authored and facebook-github-bot committed Sep 1, 2017
1 parent 3ab973e commit 77c11e8
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions React/Base/RCTManagedPointer.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */


#ifdef __cplusplus

#include <memory> #include <memory>


#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
Expand All @@ -24,11 +26,16 @@


@end @end


namespace RCT { namespace facebook {
template <typename T, typename P> namespace react {
RCTManagedPointer *managedPointer(P initializer)
{ template <typename T, typename P>
auto ptr = std::shared_ptr<void>(new T((NSDictionary *)initializer)); RCTManagedPointer *managedPointer(P initializer)
return [[RCTManagedPointer alloc] initWithPointer:std::move(ptr)]; {
} auto ptr = std::shared_ptr<void>(new T(initializer));
return [[RCTManagedPointer alloc] initWithPointer:std::move(ptr)];
} }

} }

#endif

0 comments on commit 77c11e8

Please sign in to comment.