Implement make_unique, only require c++11 in CMakeLists (Fixes #235, Refs#167)
This commit is contained in:
parent
1908a0f190
commit
b54e424d1b
2 changed files with 10 additions and 4 deletions
|
|
@ -31,9 +31,7 @@ message(STATUS ${VULKAN_LIB})
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX -D_USE_MATH_DEFINES")
|
||||
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-std=c++14)
|
||||
add_definitions(-std=c++0x)
|
||||
add_definitions(-std=gnu++14)
|
||||
add_definitions(-std=c++11)
|
||||
|
||||
file(GLOB SOURCE *.cpp base/*.cpp)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@
|
|||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
// make_unique is not available in C++11
|
||||
// Taken from Herb Sutter's blog (https://herbsutter.com/gotw/_102/)
|
||||
template<typename T, typename ...Args>
|
||||
std::unique_ptr<T> make_unique(Args&& ...args)
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
namespace vkTools
|
||||
{
|
||||
class Thread
|
||||
|
|
@ -95,7 +103,7 @@ namespace vkTools
|
|||
threads.clear();
|
||||
for (auto i = 0; i < count; i++)
|
||||
{
|
||||
threads.push_back(std::make_unique<Thread>());
|
||||
threads.push_back(make_unique<Thread>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue