[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/boostorg/python/develop/test/auto_ptr.cpp [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)

#include 
#include "test_class.hpp"
#include 
#include 
#include 
#include 

#include 

#include 

using namespace boost::python;

typedef test_class X;

struct Y : X
{
    Y(int n) : X(n) {};
};

int look(std::auto_ptr const& x)
{
    return (x.get()) ? x->value() : -1;
}

int steal(std::auto_ptr x)
{
    return x->value();
}

int maybe_steal(std::auto_ptr& x, bool doit)
{
    int n = x->value();
    if (doit)
        x.release();
    return n;
}

std::auto_ptr make()
{
    return std::auto_ptr(new X(77));
}

std::auto_ptr callback(object f)
{
    std::auto_ptr x(new X(77));
    return call(f.ptr(), x);
}

std::auto_ptr extract_(object o)
{
    return extract(o)
#if BOOST_MSVC 

Web Proxy Viewer  |  New URL  |  Original Page