C++17 support, vs builds for now

This commit is contained in:
KimLS 2020-05-19 20:22:54 -07:00
parent c330904695
commit 0b24d4ff84
11 changed files with 22 additions and 22 deletions

View File

@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2) CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH}) SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
@ -12,7 +12,7 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE) ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON) SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF) SET(CMAKE_CXX_EXTENSIONS OFF)

View File

@ -335,7 +335,7 @@ namespace luabind
template <class T> template <class T>
struct default_pointer<null_type, T> struct default_pointer<null_type, T>
{ {
typedef std::auto_ptr<T> type; typedef std::unique_ptr<T> type;
}; };
template <class Class, class Pointer, class Signature, class Policies> template <class Class, class Pointer, class Signature, class Policies>

View File

@ -46,7 +46,7 @@ struct construct_aux<0, T, Pointer, Signature>
object_rep* self = touserdata<object_rep>(self_); object_rep* self = touserdata<object_rep>(self_);
class_rep* cls = self->crep(); class_rep* cls = self->crep();
std::auto_ptr<T> instance(new T); std::unique_ptr<T> instance(new T);
inject_backref(self_.interpreter(), instance.get(), instance.get()); inject_backref(self_.interpreter(), instance.get(), instance.get());
void* naked_ptr = instance.get(); void* naked_ptr = instance.get();
@ -55,7 +55,7 @@ struct construct_aux<0, T, Pointer, Signature>
void* storage = self->allocate(sizeof(holder_type)); void* storage = self->allocate(sizeof(holder_type));
self->set_instance(new (storage) holder_type( self->set_instance(new (storage) holder_type(
ptr, registered_class<T>::id, naked_ptr, cls)); std::move(ptr), registered_class<T>::id, naked_ptr, cls));
} }
}; };
@ -92,7 +92,7 @@ struct construct_aux<N, T, Pointer, Signature>
object_rep* self = touserdata<object_rep>(self_); object_rep* self = touserdata<object_rep>(self_);
class_rep* cls = self->crep(); class_rep* cls = self->crep();
std::auto_ptr<T> instance(new T(BOOST_PP_ENUM_PARAMS(N,_))); std::unique_ptr<T> instance(new T(BOOST_PP_ENUM_PARAMS(N,_)));
inject_backref(self_.interpreter(), instance.get(), instance.get()); inject_backref(self_.interpreter(), instance.get(), instance.get());
void* naked_ptr = instance.get(); void* naked_ptr = instance.get();
@ -101,7 +101,7 @@ struct construct_aux<N, T, Pointer, Signature>
void* storage = self->allocate(sizeof(holder_type)); void* storage = self->allocate(sizeof(holder_type));
self->set_instance(new (storage) holder_type( self->set_instance(new (storage) holder_type(
ptr, registered_class<T>::id, naked_ptr, cls)); std::move(ptr), registered_class<T>::id, naked_ptr, cls));
} }
}; };

View File

@ -58,7 +58,7 @@ namespace has_get_pointer_
T* get_pointer(T const volatile*); T* get_pointer(T const volatile*);
template<class T> template<class T>
T* get_pointer(std::auto_ptr<T> const&); T* get_pointer(std::unique_ptr<T> const&);
# endif # endif

View File

@ -57,7 +57,7 @@ inline mpl::true_ check_const_pointer(void const*)
} }
template <class T> template <class T>
void release_ownership(std::auto_ptr<T>& p) void release_ownership(std::unique_ptr<T>& p)
{ {
p.release(); p.release();
} }
@ -83,7 +83,7 @@ public:
P p, class_id dynamic_id, void* dynamic_ptr, class_rep* cls P p, class_id dynamic_id, void* dynamic_ptr, class_rep* cls
) )
: instance_holder(cls, check_const_pointer(false ? get_pointer(p) : 0)) : instance_holder(cls, check_const_pointer(false ? get_pointer(p) : 0))
, p(p) , p(std::move(p))
, weak(0) , weak(0)
, dynamic_id(dynamic_id) , dynamic_id(dynamic_id)
, dynamic_ptr(dynamic_ptr) , dynamic_ptr(dynamic_ptr)

View File

@ -88,7 +88,7 @@ void make_instance(lua_State* L, P p)
try try
{ {
new (storage) holder_type(p, dynamic.first, dynamic.second, cls); new (storage) holder_type(std::move(p), dynamic.first, dynamic.second, cls);
} }
catch (...) catch (...)
{ {

View File

@ -180,8 +180,8 @@ namespace luabind { namespace detail
template <class T> template <class T>
void make_pointee_instance(lua_State* L, T& x, mpl::false_, mpl::true_) void make_pointee_instance(lua_State* L, T& x, mpl::false_, mpl::true_)
{ {
std::auto_ptr<T> ptr(new T(x)); std::unique_ptr<T> ptr(new T(x));
make_instance(L, ptr); make_instance(L, std::move(ptr));
} }
template <class T> template <class T>

View File

@ -46,7 +46,7 @@ namespace detail
template <class F, class Policies> template <class F, class Policies>
scope def(char const* name, F f, Policies const& policies) scope def(char const* name, F f, Policies const& policies)
{ {
return scope(std::auto_ptr<detail::registration>( return scope(std::unique_ptr<detail::registration>(
new detail::function_registration<F, Policies>(name, f, policies))); new detail::function_registration<F, Policies>(name, f, policies)));
} }

View File

@ -56,7 +56,7 @@ namespace luabind {
struct LUABIND_API scope struct LUABIND_API scope
{ {
scope(); scope();
explicit scope(std::auto_ptr<detail::registration> reg); explicit scope(std::unique_ptr<detail::registration> reg);
scope(scope const& other_); scope(scope const& other_);
~scope(); ~scope();

View File

@ -235,7 +235,7 @@ namespace luabind { namespace detail {
// -- interface --------------------------------------------------------- // -- interface ---------------------------------------------------------
class_base::class_base(char const* name) class_base::class_base(char const* name)
: scope(std::auto_ptr<registration>( : scope(std::unique_ptr<registration>(
m_registration = new class_registration(name)) m_registration = new class_registration(name))
) )
{ {
@ -258,14 +258,14 @@ namespace luabind { namespace detail {
void class_base::add_member(registration* member) void class_base::add_member(registration* member)
{ {
std::auto_ptr<registration> ptr(member); std::unique_ptr<registration> ptr(member);
m_registration->m_members.operator,(scope(ptr)); m_registration->m_members.operator,(scope(std::move(ptr)));
} }
void class_base::add_default_member(registration* member) void class_base::add_default_member(registration* member)
{ {
std::auto_ptr<registration> ptr(member); std::unique_ptr<registration> ptr(member);
m_registration->m_default_members.operator,(scope(ptr)); m_registration->m_default_members.operator,(scope(std::move(ptr)));
} }
const char* class_base::name() const const char* class_base::name() const

View File

@ -49,7 +49,7 @@ namespace luabind { namespace detail {
{ {
} }
scope::scope(std::auto_ptr<detail::registration> reg) scope::scope(std::unique_ptr<detail::registration> reg)
: m_chain(reg.release()) : m_chain(reg.release())
{ {
} }
@ -193,7 +193,7 @@ namespace luabind {
}; };
namespace_::namespace_(char const* name) namespace_::namespace_(char const* name)
: scope(std::auto_ptr<detail::registration>( : scope(std::unique_ptr<detail::registration>(
m_registration = new registration_(name))) m_registration = new registration_(name)))
{ {
} }