Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/test/borrowed.cpp @ 45

Last change on this file since 45 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.0 KB
Line 
1// Copyright David Abrahams 2002.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5#include <boost/python/detail/wrap_python.hpp>
6#include <boost/python/borrowed.hpp>
7#include <boost/static_assert.hpp>
8
9using namespace boost::python;
10
11template <class T>
12void assert_borrowed_ptr(T const& x)
13{
14    BOOST_STATIC_ASSERT(boost::python::detail::is_borrowed_ptr<T>::value);
15}
16   
17template <class T>
18void assert_not_borrowed_ptr(T const& x)
19{
20    BOOST_STATIC_ASSERT(!boost::python::detail::is_borrowed_ptr<T>::value);
21}
22   
23int main()
24{
25    assert_borrowed_ptr(borrowed((PyObject*)0));
26    assert_borrowed_ptr(borrowed((PyTypeObject*)0));
27    assert_borrowed_ptr((detail::borrowed<PyObject> const*)0);
28    assert_borrowed_ptr((detail::borrowed<PyObject> volatile*)0);
29    assert_borrowed_ptr((detail::borrowed<PyObject> const volatile*)0);
30    assert_not_borrowed_ptr((PyObject*)0);
31    assert_not_borrowed_ptr(0);
32    return 0;
33}
Note: See TracBrowser for help on using the repository browser.