On 07/22/2017 04:20 AM, Domen Vrankar via Boost wrote:
2017-07-22 6:15 GMT+02:00 Phil Bouchard via Boost
: Greetings,
Now I have an example showing off the cyclic reference handling. Please see: https://github.com/philippeb8/root_ptr/blob/bb++/bbpp2cpp/tests/input2.bb
This program correctly outputs:
Document::Document(const boost::node_proxy&) auto __0(boost::node_proxy&, int) 1 Document::Document(const boost::node_proxy&) Document::~Document() 2 Document::~Document()
I just fixed an important bug where the node_proxies were passed by value because of the variadic template arguments misuse; now they are passed by reference in the 'make_*' factory. Furthermore you can see by yourselves the following code example works perfectly fine now: class Document { auto head = nullptr<Document>(); auto tail = nullptr<Document>(); Document() { cout << __PRETTY_FUNCTION__ << endl; } ~Document() { cout << __PRETTY_FUNCTION__ << endl; } auto foo = function (int argument) { cout << __PRETTY_FUNCTION__ << endl; return argument; }; }; int main() { auto temporary = 1; auto document = new Document(); document.foo(temporary); auto bar = function () { auto document = new Document(); // cycle document.head = document; return document; }; cout << 1 << endl; auto result = bar().foo(temporary); cout << 2 << endl; } Correctly outputs: Document::Document(const boost::node_proxy&) auto __lambda0(boost::node_proxy&, int) 1 Document::Document(const boost::node_proxy&) auto __lambda0(boost::node_proxy&, int) 2 Document::~Document() Document::~Document() Thank you, -Phil