[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/boostorg/python/develop/include/boost/python/refcount.hpp [Back]  [Original]

// Copyright David Abrahams 2002.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef REFCOUNT_DWA2002615_HPP
# define REFCOUNT_DWA2002615_HPP

# include 
# include 

namespace boost { namespace python { 

template 
inline T* incref(T* p)
{
    Py_INCREF(python::upcast(p));
    return p;
}

template 
inline T* xincref(T* p)
{
    Py_XINCREF(python::upcast(p));
    return p;
}

template 
inline void decref(T* p)
{
    assert( Py_REFCNT(python::upcast(p)) > 0 );
    Py_DECREF(python::upcast(p));
}

template 
inline void xdecref(T* p)
{
    assert( !p || Py_REFCNT(python::upcast(p)) > 0 );
    Py_XDECREF(python::upcast(p));
}

}} // namespace boost::python

#endif // REFCOUNT_DWA2002615_HPP

Web Proxy Viewer  |  New URL  |  Original Page