Closed ArashHosseini closed 6 years ago
Hi.
std::make_unique
is a C++14 feature and c++1y doesn't support in some environments.
But it is possible to implement it.
https://stackoverflow.com/a/24609331
I recommend updating to gcc6. https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91
i have implemented it as suggested by You. it was pretty straight forward. wherever make_unique occurred by adding the following lines solved the compiling stage for three and imgplot
modified: imgplot/core/data/image.cpp
modified: imgplot/core/data/object.cpp
modified: imgplot/core/view/image.cpp
modified: imgplot/core/view/object.cpp
modified: imgplot/core/window.cpp
modified: three/core/base/object.cpp
modified: three/core/renderer/renderer.cpp
modified: three/core/scene/cornell_box.cpp
modified: three/core/scene/object.cpp
namespace std {
template<class T> struct _Unique_if {
typedef unique_ptr<T> _Single_object;
};
template<class T> struct _Unique_if<T[]> {
typedef unique_ptr<T[]> _Unknown_bound;
};
template<class T, size_t N> struct _Unique_if<T[N]> {
typedef void _Known_bound;
};
template<class T, class... Args>
typename _Unique_if<T>::_Single_object
make_unique(Args&&... args) {
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template<class T>
typename _Unique_if<T>::_Unknown_bound
make_unique(size_t n) {
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
template<class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_unique(Args&&...) = delete;
}
*also including system_error to window.cpp file thx again
hey @musyoku, my env is g ++ 4.8.4 on Ubuntu 14.04 LTS, so I used -std =c++1y, can you give a hint what it could be, thanks