mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-27 19:25:11 +08:00
RCTManagedPointer fix ups
Reviewed By: javache Differential Revision: D5727367 fbshipit-source-id: ef6c03e57ee0c40da9411c77f0e8a733945afa07
This commit is contained in:
committed by
Facebook Github Bot
parent
3ab973ed80
commit
77c11e831b
@@ -7,6 +7,8 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <memory>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@@ -24,11 +26,16 @@
|
||||
|
||||
@end
|
||||
|
||||
namespace RCT {
|
||||
template <typename T, typename P>
|
||||
RCTManagedPointer *managedPointer(P initializer)
|
||||
{
|
||||
auto ptr = std::shared_ptr<void>(new T((NSDictionary *)initializer));
|
||||
return [[RCTManagedPointer alloc] initWithPointer:std::move(ptr)];
|
||||
}
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
template <typename T, typename P>
|
||||
RCTManagedPointer *managedPointer(P initializer)
|
||||
{
|
||||
auto ptr = std::shared_ptr<void>(new T(initializer));
|
||||
return [[RCTManagedPointer alloc] initWithPointer:std::move(ptr)];
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user