pointers/truletest.cpp

The following code example is taken from the book
C++ Templates - The Complete Guide
by David Vandevoorde and Nicolai M. Josuttis, Addison-Wesley, 2002
© Copyright David Vandevoorde and Nicolai M. Josuttis 2002


#include "holder2.hpp"
#include "trule.hpp"

class Something {
};

void read_something (Something* x)
{
}

Trule<Something> load_something() 
{
    Holder<Something> result(new Something);
    read_something(result.get());
    return result;
}

int main() 
{
    Holder<Something> ptr(load_something());
    //...
}