File tree Expand file tree Collapse file tree 14 files changed +49
-22
lines changed Expand file tree Collapse file tree 14 files changed +49
-22
lines changed Original file line number Diff line number Diff line change 180180 <ClInclude Include =" ..\xrCommon\xr_list.h" />
181181 <ClInclude Include =" ..\xrCommon\xr_map.h" />
182182 <ClInclude Include =" ..\xrCommon\xr_set.h" />
183+ <ClInclude Include =" ..\xrCommon\xr_smart_pointers.h" />
183184 <ClInclude Include =" ..\xrCommon\xr_stack.h" />
184185 <ClInclude Include =" ..\xrCommon\xr_string.h" />
185186 <ClInclude Include =" ..\xrCommon\xr_unordered_map.h" />
Original file line number Diff line number Diff line change 8585 <ClInclude Include =" ..\xrCommon\xr_array.h" >
8686 <Filter >xrCommon</Filter >
8787 </ClInclude >
88+ <ClInclude Include =" ..\xrCommon\xr_smart_pointers.h" >
89+ <Filter >xrCommon</Filter >
90+ </ClInclude >
8891 </ItemGroup >
8992 <ItemGroup >
9093 <Filter Include =" NvMender2003" >
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ typedef TMsgDlgBtn TMsgDlgButtons[mbHelp];
108108#include " xrCore/xr_token.h"
109109#include " xrCommon/xr_vector.h"
110110#include " xrCommon/xr_string.h"
111+ #include " xrCommon/xr_smart_pointers.h"
111112#include " xrCore/Animation/Bone.hpp"
112113#include " xrCore/Animation/Motion.hpp"
113114
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < memory>
4+
5+ template <typename T>
6+ using xr_unique_ptr = std::unique_ptr<T>;
7+
8+ template <typename T>
9+ using xr_shared_ptr = std::shared_ptr<T>;
10+
11+ template <class T , class ... Args>
12+ inline xr_unique_ptr<T> xr_make_unique (Args&&... args)
13+ {
14+ return std::make_unique<T>(args...);
15+ }
16+
17+ template <class T , class ... Args>
18+ inline xr_shared_ptr<T> xr_make_shared (Args&&... args)
19+ {
20+ return std::make_shared<T>(args...);
21+ }
Original file line number Diff line number Diff line change 1111#include " vfw.h"
1212#endif
1313
14- std::unique_ptr <EFS_Utils> xr_EFS;
14+ xr_unique_ptr <EFS_Utils> xr_EFS;
1515// ----------------------------------------------------
1616EFS_Utils::EFS_Utils () {}
1717EFS_Utils::~EFS_Utils () {}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class XRCORE_API EFS_Utils
4242 static xr_string ExtractFileExt (LPCSTR src);
4343 static xr_string ExcludeBasePath (LPCSTR full_path, LPCSTR excl_path);
4444};
45- extern XRCORE_API std::unique_ptr <EFS_Utils> xr_EFS;
45+ extern XRCORE_API xr_unique_ptr <EFS_Utils> xr_EFS;
4646#define EFS (*xr_EFS)
4747
4848#endif /* _INCDEF_FileSystem_H_*/
Original file line number Diff line number Diff line change 2626
2727const u32 BIG_FILE_READER_WINDOW_SIZE = 1024 * 1024 ;
2828
29- std::unique_ptr <CLocatorAPI> xr_FS;
29+ xr_unique_ptr <CLocatorAPI> xr_FS;
3030
3131#ifdef _EDITOR
3232static constexpr pcstr FSLTX = " fs.ltx"
Original file line number Diff line number Diff line change 1010#include " LocatorAPI_defs.h"
1111// #include "xrCore/Threading/Lock.hpp"
1212#include " xrCommon/xr_map.h"
13+ #include " xrCommon/xr_smart_pointers.h"
1314#include " xrCommon/predicates.h"
1415#include " Common/Noncopyable.hpp"
1516
@@ -255,5 +256,5 @@ class XRCORE_API CLocatorAPI : Noncopyable
255256 void unlock_rescan ();
256257};
257258
258- extern XRCORE_API std::unique_ptr <CLocatorAPI> xr_FS;
259+ extern XRCORE_API xr_unique_ptr <CLocatorAPI> xr_FS;
259260#define FS (*xr_FS)
Original file line number Diff line number Diff line change 11#pragma once
2- #include < memory >
2+ #include " xrCommon/xr_smart_pointers.h "
33
44namespace XRay
55{
@@ -23,15 +23,15 @@ class XRCORE_API ModuleHandle
2323 void * GetProcAddress (pcstr procName) const ;
2424};
2525
26- using Module = std::unique_ptr <ModuleHandle>;
26+ using Module = xr_unique_ptr <ModuleHandle>;
2727
2828inline auto LoadModule (bool dontUnload = false )
2929{
30- return std::make_unique <ModuleHandle>(dontUnload);
30+ return xr_make_unique <ModuleHandle>(dontUnload);
3131}
3232
3333inline auto LoadModule (pcstr moduleName, bool dontUnload = false )
3434{
35- return std::make_unique <ModuleHandle>(moduleName, dontUnload);
35+ return xr_make_unique <ModuleHandle>(moduleName, dontUnload);
3636}
3737}
Original file line number Diff line number Diff line change 1515#include < mutex>
1616#include < condition_variable>
1717#include < functional>
18- #include < memory >
18+ #include " xrCommon/xr_smart_pointers.h "
1919
2020class XRCORE_API Thread
2121{
@@ -42,7 +42,7 @@ class XRCORE_API Thread
4242class ThreadPool
4343{
4444public:
45- xr_vector<std::unique_ptr <Thread>> threads;
45+ xr_vector<xr_unique_ptr <Thread>> threads;
4646
4747 void initialize ()
4848 {
You can’t perform that action at this time.
0 commit comments