switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr
This is mostly a simple lexical search+replace but the absence of operator< for std::weak_ptr<T> leads to some complications, particularly with Evoral::Sequence and ExportPortChannel.
This commit is contained in:
@@ -342,7 +342,7 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
assert (isfulluserdata (L, lua_upvalueindex (1)));
|
||||
boost::shared_ptr<T>* const t = Userdata::get <boost::shared_ptr<T> > (L, 1, false);
|
||||
std::shared_ptr<T>* const t = Userdata::get <std::shared_ptr<T> > (L, 1, false);
|
||||
T* const tt = t->get();
|
||||
if (!tt) {
|
||||
return luaL_error (L, "shared_ptr is nil");
|
||||
@@ -360,8 +360,8 @@ struct CFunc
|
||||
{
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
boost::shared_ptr<T> t = luabridge::Stack<boost::shared_ptr<T> >::get (L, 1);
|
||||
Stack <boost::shared_ptr<R> >::push (L, boost::dynamic_pointer_cast<R> (t));
|
||||
std::shared_ptr<T> t = luabridge::Stack<std::shared_ptr<T> >::get (L, 1);
|
||||
Stack <std::shared_ptr<R> >::push (L, std::dynamic_pointer_cast<R> (t));
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
@@ -405,7 +405,7 @@ struct CFunc
|
||||
{
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
boost::shared_ptr<T> t = luabridge::Stack<boost::shared_ptr<T> >::get (L, 1);
|
||||
std::shared_ptr<T> t = luabridge::Stack<std::shared_ptr<T> >::get (L, 1);
|
||||
Stack <bool>::push (L, t == 0);
|
||||
return 1;
|
||||
}
|
||||
@@ -417,8 +417,8 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
bool rv = true;
|
||||
boost::weak_ptr<T> tw = luabridge::Stack<boost::weak_ptr<T> >::get (L, 1);
|
||||
boost::shared_ptr<T> const t = tw.lock();
|
||||
std::weak_ptr<T> tw = luabridge::Stack<std::weak_ptr<T> >::get (L, 1);
|
||||
std::shared_ptr<T> const t = tw.lock();
|
||||
if (t) {
|
||||
T* const tt = t.get();
|
||||
rv = (tt == 0);
|
||||
@@ -433,8 +433,8 @@ struct CFunc
|
||||
{
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
boost::shared_ptr<T> t0 = luabridge::Stack<boost::shared_ptr<T> >::get (L, 1);
|
||||
boost::shared_ptr<T> t1 = luabridge::Stack<boost::shared_ptr<T> >::get (L, 2);
|
||||
std::shared_ptr<T> t0 = luabridge::Stack<std::shared_ptr<T> >::get (L, 1);
|
||||
std::shared_ptr<T> t1 = luabridge::Stack<std::shared_ptr<T> >::get (L, 2);
|
||||
Stack <bool>::push (L, t0 == t1);
|
||||
return 1;
|
||||
}
|
||||
@@ -446,10 +446,10 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
bool rv = false;
|
||||
boost::weak_ptr<T> tw0 = luabridge::Stack<boost::weak_ptr<T> >::get (L, 1);
|
||||
boost::weak_ptr<T> tw1 = luabridge::Stack<boost::weak_ptr<T> >::get (L, 2);
|
||||
boost::shared_ptr<T> const t0 = tw0.lock();
|
||||
boost::shared_ptr<T> const t1 = tw1.lock();
|
||||
std::weak_ptr<T> tw0 = luabridge::Stack<std::weak_ptr<T> >::get (L, 1);
|
||||
std::weak_ptr<T> tw1 = luabridge::Stack<std::weak_ptr<T> >::get (L, 2);
|
||||
std::shared_ptr<T> const t0 = tw0.lock();
|
||||
std::shared_ptr<T> const t1 = tw1.lock();
|
||||
if (t0 && t1) {
|
||||
T* const tt0 = t0.get();
|
||||
T* const tt1 = t1.get();
|
||||
@@ -461,7 +461,7 @@ struct CFunc
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct ClassEqualCheck<boost::shared_ptr<T> >
|
||||
struct ClassEqualCheck<std::shared_ptr<T> >
|
||||
{
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
@@ -470,7 +470,7 @@ struct CFunc
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct ClassEqualCheck<boost::weak_ptr<T> >
|
||||
struct ClassEqualCheck<std::weak_ptr<T> >
|
||||
{
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
@@ -481,7 +481,7 @@ struct CFunc
|
||||
template <class C, typename T>
|
||||
static int getPtrProperty (lua_State* L)
|
||||
{
|
||||
boost::shared_ptr<C> cp = luabridge::Stack<boost::shared_ptr<C> >::get (L, 1);
|
||||
std::shared_ptr<C> cp = luabridge::Stack<std::shared_ptr<C> >::get (L, 1);
|
||||
C const* const c = cp.get();
|
||||
if (!c) {
|
||||
return luaL_error (L, "shared_ptr is nil");
|
||||
@@ -494,8 +494,8 @@ struct CFunc
|
||||
template <class C, typename T>
|
||||
static int getWPtrProperty (lua_State* L)
|
||||
{
|
||||
boost::weak_ptr<C> cw = luabridge::Stack<boost::weak_ptr<C> >::get (L, 1);
|
||||
boost::shared_ptr<C> const cp = cw.lock();
|
||||
std::weak_ptr<C> cw = luabridge::Stack<std::weak_ptr<C> >::get (L, 1);
|
||||
std::shared_ptr<C> const cp = cw.lock();
|
||||
if (!cp) {
|
||||
return luaL_error (L, "cannot lock weak_ptr");
|
||||
}
|
||||
@@ -511,7 +511,7 @@ struct CFunc
|
||||
template <class C, typename T>
|
||||
static int setPtrProperty (lua_State* L)
|
||||
{
|
||||
boost::shared_ptr<C> cp = luabridge::Stack<boost::shared_ptr<C> >::get (L, 1);
|
||||
std::shared_ptr<C> cp = luabridge::Stack<std::shared_ptr<C> >::get (L, 1);
|
||||
C* const c = cp.get();
|
||||
if (!c) {
|
||||
return luaL_error (L, "shared_ptr is nil");
|
||||
@@ -524,8 +524,8 @@ struct CFunc
|
||||
template <class C, typename T>
|
||||
static int setWPtrProperty (lua_State* L)
|
||||
{
|
||||
boost::weak_ptr<C> cw = luabridge::Stack<boost::weak_ptr<C> >::get (L, 1);
|
||||
boost::shared_ptr<C> cp = cw.lock();
|
||||
std::weak_ptr<C> cw = luabridge::Stack<std::weak_ptr<C> >::get (L, 1);
|
||||
std::shared_ptr<C> cp = cw.lock();
|
||||
if (!cp) {
|
||||
return luaL_error (L, "cannot lock weak_ptr");
|
||||
}
|
||||
@@ -547,8 +547,8 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
assert (isfulluserdata (L, lua_upvalueindex (1)));
|
||||
boost::weak_ptr<T>* const tw = Userdata::get <boost::weak_ptr<T> > (L, 1, false);
|
||||
boost::shared_ptr<T> const t = tw->lock();
|
||||
std::weak_ptr<T>* const tw = Userdata::get <std::weak_ptr<T> > (L, 1, false);
|
||||
std::shared_ptr<T> const t = tw->lock();
|
||||
if (!t) {
|
||||
return luaL_error (L, "cannot lock weak_ptr");
|
||||
}
|
||||
@@ -620,7 +620,7 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
assert (isfulluserdata (L, lua_upvalueindex (1)));
|
||||
boost::shared_ptr<T>* const t = Userdata::get <boost::shared_ptr<T> > (L, 1, false);
|
||||
std::shared_ptr<T>* const t = Userdata::get <std::shared_ptr<T> > (L, 1, false);
|
||||
T* const tt = t->get();
|
||||
if (!tt) {
|
||||
return luaL_error (L, "shared_ptr is nil");
|
||||
@@ -645,8 +645,8 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
assert (isfulluserdata (L, lua_upvalueindex (1)));
|
||||
boost::weak_ptr<T>* const tw = Userdata::get <boost::weak_ptr<T> > (L, 1, false);
|
||||
boost::shared_ptr<T> const t = tw->lock();
|
||||
std::weak_ptr<T>* const tw = Userdata::get <std::weak_ptr<T> > (L, 1, false);
|
||||
std::shared_ptr<T> const t = tw->lock();
|
||||
if (!t) {
|
||||
return luaL_error (L, "cannot lock weak_ptr");
|
||||
}
|
||||
@@ -716,7 +716,7 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
assert (isfulluserdata (L, lua_upvalueindex (1)));
|
||||
boost::shared_ptr<T>* const t = Userdata::get <boost::shared_ptr<T> > (L, 1, false);
|
||||
std::shared_ptr<T>* const t = Userdata::get <std::shared_ptr<T> > (L, 1, false);
|
||||
T* const tt = t->get();
|
||||
MemFnPtr const& fnptr = *static_cast <MemFnPtr const*> (lua_touserdata (L, lua_upvalueindex (1)));
|
||||
assert (fnptr != 0);
|
||||
@@ -734,8 +734,8 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
assert (isfulluserdata (L, lua_upvalueindex (1)));
|
||||
boost::weak_ptr<T>* const tw = Userdata::get <boost::weak_ptr<T> > (L, 1, false);
|
||||
boost::shared_ptr<T> const t = tw->lock();
|
||||
std::weak_ptr<T>* const tw = Userdata::get <std::weak_ptr<T> > (L, 1, false);
|
||||
std::shared_ptr<T> const t = tw->lock();
|
||||
if (!t) {
|
||||
return luaL_error (L, "cannot lock weak_ptr");
|
||||
}
|
||||
@@ -801,7 +801,7 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
assert (isfulluserdata (L, lua_upvalueindex (1)));
|
||||
boost::shared_ptr<T>* const t = Userdata::get <boost::shared_ptr<T> > (L, 1, false);
|
||||
std::shared_ptr<T>* const t = Userdata::get <std::shared_ptr<T> > (L, 1, false);
|
||||
T* const tt = t->get();
|
||||
if (!tt) {
|
||||
return luaL_error (L, "shared_ptr is nil");
|
||||
@@ -825,8 +825,8 @@ struct CFunc
|
||||
static int f (lua_State* L)
|
||||
{
|
||||
assert (isfulluserdata (L, lua_upvalueindex (1)));
|
||||
boost::weak_ptr<T>* const tw = Userdata::get <boost::weak_ptr<T> > (L, 1, false);
|
||||
boost::shared_ptr<T> const t = tw->lock();
|
||||
std::weak_ptr<T>* const tw = Userdata::get <std::weak_ptr<T> > (L, 1, false);
|
||||
std::shared_ptr<T> const t = tw->lock();
|
||||
if (!t) {
|
||||
return luaL_error (L, "cannot lock weak_ptr");
|
||||
}
|
||||
@@ -1146,7 +1146,7 @@ struct CFunc
|
||||
template <class T, class C>
|
||||
static int ptrTableToList (lua_State *L)
|
||||
{
|
||||
boost::shared_ptr<C> const* const t = Userdata::get<boost::shared_ptr<C> > (L, 1, true);
|
||||
std::shared_ptr<C> const* const t = Userdata::get<std::shared_ptr<C> > (L, 1, true);
|
||||
if (!t) { return luaL_error (L, "cannot derefencee shared_ptr"); }
|
||||
return tableToListHelper<T, C> (L, t->get());
|
||||
}
|
||||
@@ -1200,7 +1200,7 @@ struct CFunc
|
||||
template <class T, class C>
|
||||
static int ptrListIter (lua_State *L)
|
||||
{
|
||||
boost::shared_ptr<C> const* const t = Userdata::get <boost::shared_ptr<C> >(L, 1, true);
|
||||
std::shared_ptr<C> const* const t = Userdata::get <std::shared_ptr<C> >(L, 1, true);
|
||||
if (!t) { return luaL_error (L, "cannot derefencee shared_ptr"); }
|
||||
return listIterHelper<T, C> (L, t->get());
|
||||
}
|
||||
@@ -1241,7 +1241,7 @@ struct CFunc
|
||||
template <class T, class C>
|
||||
static int ptrListToTable (lua_State *L)
|
||||
{
|
||||
boost::shared_ptr<C> const* const t = Userdata::get <boost::shared_ptr<C> > (L, 1, true);
|
||||
std::shared_ptr<C> const* const t = Userdata::get <std::shared_ptr<C> > (L, 1, true);
|
||||
if (!t) { return luaL_error (L, "cannot derefencee shared_ptr"); }
|
||||
return listToTableHelper<T, C> (L, t->get());
|
||||
}
|
||||
|
||||
@@ -1333,14 +1333,14 @@ private:
|
||||
FUNDOC ("Weak/Shared Pointer Constructor", "", MemFn)
|
||||
set_shared_class ();
|
||||
lua_pushcclosure (L,
|
||||
&shared. template ctorPtrPlacementProxy <typename FuncTraits <MemFn>::Params, boost::shared_ptr<T>, T >, 0);
|
||||
&shared. template ctorPtrPlacementProxy <typename FuncTraits <MemFn>::Params, std::shared_ptr<T>, T >, 0);
|
||||
rawsetfield(L, -2, "__call");
|
||||
|
||||
set_weak_class ();
|
||||
// NOTE: this constructs an empty weak-ptr,
|
||||
// ideally we'd construct a weak-ptr from a referenced shared-ptr
|
||||
lua_pushcclosure (L,
|
||||
&weak. template ctorPlacementProxy <typename FuncTraits <MemFn>::Params, boost::weak_ptr<T> >, 0);
|
||||
&weak. template ctorPlacementProxy <typename FuncTraits <MemFn>::Params, std::weak_ptr<T> >, 0);
|
||||
rawsetfield(L, -2, "__call");
|
||||
return *this;
|
||||
}
|
||||
@@ -1371,14 +1371,14 @@ private:
|
||||
FUNDOC ("Weak/Shared Pointer NIL Constructor", "", void (*) ())
|
||||
set_shared_class ();
|
||||
lua_pushcclosure (L,
|
||||
&shared. template ctorNilPtrPlacementProxy <boost::shared_ptr<T> >, 0);
|
||||
&shared. template ctorNilPtrPlacementProxy <std::shared_ptr<T> >, 0);
|
||||
rawsetfield(L, -2, "__call");
|
||||
|
||||
set_weak_class ();
|
||||
// NOTE: this constructs an empty weak-ptr,
|
||||
// ideally we'd construct a weak-ptr from a referenced shared-ptr
|
||||
lua_pushcclosure (L,
|
||||
&weak. template ctorNilPtrPlacementProxy <boost::weak_ptr<T> >, 0);
|
||||
&weak. template ctorNilPtrPlacementProxy <std::weak_ptr<T> >, 0);
|
||||
rawsetfield(L, -2, "__call");
|
||||
|
||||
return *this;
|
||||
@@ -1518,7 +1518,7 @@ private:
|
||||
private:
|
||||
void set_weak_class () {
|
||||
lua_pop (L, 3);
|
||||
lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo <boost::weak_ptr<T> >::getStaticKey ());
|
||||
lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo <std::weak_ptr<T> >::getStaticKey ());
|
||||
rawgetfield (L, -1, "__class");
|
||||
rawgetfield (L, -1, "__const");
|
||||
lua_insert (L, -3);
|
||||
@@ -1526,14 +1526,14 @@ private:
|
||||
}
|
||||
void set_shared_class () {
|
||||
lua_pop (L, 3);
|
||||
lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo <boost::shared_ptr<T> >::getStaticKey ());
|
||||
lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo <std::shared_ptr<T> >::getStaticKey ());
|
||||
rawgetfield (L, -1, "__class");
|
||||
rawgetfield (L, -1, "__const");
|
||||
lua_insert (L, -3);
|
||||
lua_insert (L, -2);
|
||||
}
|
||||
Class<boost::shared_ptr<T> > shared;
|
||||
Class<boost::weak_ptr<T> > weak;
|
||||
Class<std::shared_ptr<T> > shared;
|
||||
Class<std::weak_ptr<T> > weak;
|
||||
};
|
||||
|
||||
|
||||
@@ -2030,11 +2030,11 @@ public:
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
template <class T>
|
||||
Class<boost::shared_ptr<std::list<T> > > beginPtrStdList (char const* name)
|
||||
Class<std::shared_ptr<std::list<T> > > beginPtrStdList (char const* name)
|
||||
{
|
||||
typedef std::list<T> LT;
|
||||
typedef typename LT::size_type T_SIZE;
|
||||
return beginClass<boost::shared_ptr<LT> > (name)
|
||||
return beginClass<std::shared_ptr<LT> > (name)
|
||||
//.addVoidPtrConstructor<LT> ()
|
||||
.addPtrFunction ("empty", (bool (LT::*)()const)<::empty)
|
||||
.addPtrFunction ("size", (T_SIZE (LT::*)()const)<::size)
|
||||
@@ -2054,13 +2054,13 @@ public:
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Class<boost::shared_ptr<std::vector<T> > > beginPtrStdVector (char const* name)
|
||||
Class<std::shared_ptr<std::vector<T> > > beginPtrStdVector (char const* name)
|
||||
{
|
||||
typedef std::vector<T> LT;
|
||||
typedef typename std::vector<T>::reference T_REF;
|
||||
typedef typename std::vector<T>::size_type T_SIZE;
|
||||
|
||||
return beginClass<boost::shared_ptr<LT> > (name)
|
||||
return beginClass<std::shared_ptr<LT> > (name)
|
||||
//.addVoidPtrConstructor<LT> ()
|
||||
.addPtrFunction ("empty", (bool (LT::*)()const)<::empty)
|
||||
.addPtrFunction ("size", (T_SIZE (LT::*)()const)<::size)
|
||||
@@ -2089,12 +2089,12 @@ public:
|
||||
WSPtrClass <T> deriveWSPtrClass (char const* name)
|
||||
{
|
||||
|
||||
CLASSDOC ("[C] Derived Class", _name << name, type_name <boost::shared_ptr<T> >(), type_name <boost::shared_ptr<U> >())
|
||||
CLASSDOC ("[C] Derived Class", _name << name, type_name <boost::weak_ptr<T> >(), type_name <boost::weak_ptr<U> >())
|
||||
CLASSDOC ("[C] Derived Class", _name << name, type_name <std::shared_ptr<T> >(), type_name <std::shared_ptr<U> >())
|
||||
CLASSDOC ("[C] Derived Class", _name << name, type_name <std::weak_ptr<T> >(), type_name <std::weak_ptr<U> >())
|
||||
CLASSDOC ("[C] Derived Pointer Class", _name << name, type_name <T>(), type_name <U>())
|
||||
return WSPtrClass <T> (name, this,
|
||||
ClassInfo <boost::shared_ptr<U> >::getStaticKey (),
|
||||
ClassInfo <boost::weak_ptr<U> >::getStaticKey ())
|
||||
ClassInfo <std::shared_ptr<U> >::getStaticKey (),
|
||||
ClassInfo <std::weak_ptr<U> >::getStaticKey ())
|
||||
.addNullCheck()
|
||||
.addEqualCheck();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user