Update of /cvsroot/luabind/luabind/luabind/doc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24965/doc
Modified Files:
Tag: beta7-devel2
docs.html docs.rst
Log Message:
properties now make the returned reference keep the object alive using the dependency policy
Index: docs.html
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/doc/docs.html,v
retrieving revision 1.52.2.10
retrieving revision 1.52.2.11
diff -u -d -r1.52.2.10 -r1.52.2.11
--- docs.html 26 Oct 2005 09:44:23 -0000 1.52.2.10
+++ docs.html 26 Oct 2005 16:10:26 -0000 1.52.2.11
@@ -7,7 +7,7 @@
<title>luabind</title>
<meta name="author" content="Daniel Wallin, Arvid Norberg" />
<meta name="copyright" content="Copyright Daniel Wallin, Arvid Norberg 2003." />
-<meta name="date" content="2005-10-24" />
+<meta name="date" content="2005-10-26" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
@@ -22,9 +22,9 @@
<tr><th class="docinfo-name">Copyright:</th>
<td>Copyright Daniel Wallin, Arvid Norberg 2003.</td></tr>
<tr><th class="docinfo-name">Date:</th>
-<td>2005-10-24</td></tr>
+<td>2005-10-26</td></tr>
<tr><th class="docinfo-name">Revision:</th>
-<td>1.25.2.11</td></tr>
+<td>1.25.2.12</td></tr>
<tr class="field"><th class="docinfo-name">License:</th><td class="field-body"><p class="first">Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
@@ -639,7 +639,10 @@
assert(b.a.m == 1)
</pre>
<p>This requires the first lookup (on <tt class="docutils literal"><span class="pre">a</span></tt>) to return a reference to <tt class="docutils literal"><span class="pre">A</span></tt>, and
-not a copy.</p>
+not a copy. In that case, luabind will automatically use the dependency policy
+to make the return value dependent on the object in which it is stored. So, if
+the returned reference lives longer than all references to the object (b in
+this case) it will keep the object alive, to avoid being a dangling pointer.</p>
<p>You can also register getter and setter functions and make them look as if they
were a public data member. Consider the following class:</p>
<pre class="literal-block">
Index: docs.rst
===================================================================
RCS file: /cvsroot/luabind/luabind/luabind/doc/docs.rst,v
retrieving revision 1.25.2.12
retrieving revision 1.25.2.13
diff -u -d -r1.25.2.12 -r1.25.2.13
--- docs.rst 26 Oct 2005 09:44:23 -0000 1.25.2.12
+++ docs.rst 26 Oct 2005 16:10:26 -0000 1.25.2.13
@@ -622,7 +622,10 @@
assert(b.a.m == 1)
This requires the first lookup (on ``a``) to return a reference to ``A``, and
-not a copy.
+not a copy. In that case, luabind will automatically use the dependency policy
+to make the return value dependent on the object in which it is stored. So, if
+the returned reference lives longer than all references to the object (b in
+this case) it will keep the object alive, to avoid being a dangling pointer.
You can also register getter and setter functions and make them look as if they
were a public data member. Consider the following class::
|