Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/python/test/upcast.cpp @ 12

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

added boost

  • Property svn:executable set to *
File size: 487 bytes
RevLine 
[12]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/cast.hpp>
6
7struct X { long x; };
8struct Y : X, PyObject {};
9
10int main()
11{
12    PyTypeObject o;
13    Y y;
14    assert(&boost::python::upcast<PyObject>(&o)->ob_refcnt == &o.ob_refcnt);
15    assert(&boost::python::upcast<PyObject>(&y)->ob_refcnt == &y.ob_refcnt);
16    return 0;
17}
18
Note: See TracBrowser for help on using the repository browser.