On Wed, Sep 10, 2008 at 4:35 PM, Paul Martz <[EMAIL PROTECTED]> wrote: >> What I don't understand is >> why he doesn't just return "grp" and let it call the copy ctor. > > In the example you cited, I could've done as you suggest. But as you and > Robert already discussed, this wouldn't work if the return type were a > ref_ptr to a base class of Group. > > I figure there are two types of programmers: those who know C++ and can spin > up on things like ref_ptr in a matter if a few minutes just by glancing at > the code, and those who aren't so experienced and need some hand holding. To > address the needs of the latter group, the section on ref_ptr could have > been an entire chapter unto itself. To keep the book short and affordable, I > decided to give them a set of short but "safe" instructions that would keep > them out of trouble when using ref_ptrs. Exploring all of ref_ptr's ins and > outs is left as an exercise to the reader. (There are, of course, multiple > ways to return ref_ptr memory from a function. If I update the book, I'll > consider recommending release(), for example.) > > Thanks for reading the book. > > Paul Martz > Skew Matrix Software LLC > http://www.skew-matrix.com > +1 303 859 9466 >
Once I picked up on that, I figured out where you are coming from with the book. It's a smart way to write it if you want to keep it short, but now I know to just apply my knowledge of C++ to it and not be afraid that there's something you're not telling us in the book. Or rather, there's a lot you're not telling us, but you are telling us what we need to know. And no, thank YOU for writing it. It's a great introduction to OSG, and it's only around 100 pages long. I'm glad the boss paid for the hardcopy :-) _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

