> I'm not familiar with boost scoped_ptr, and won't have time to dig > into it for a couple of days. Assuming it is simple and useful (i.e. > it really does simplify the C++ code we end up writing and > maintaining), I don't have a problem with adopting it.
Scoped_ptr must be the simplest smart pointer existing, but useful:
// scoped_ptr mimics a built-in pointer except that it guarantees deletion
// of the object pointed to, either on destruction of the scoped_ptr or via
// an explicit reset().
Basically:
Template< class T >
Class scoped_ptr {
T* ptr;
Public:
Explicit scoped_ptr(T* p=NULL):ptr(p) {}
~scoped_ptr() { delete ptr; }
// function get, op -> ,...
}
Attached the scoped_ptr extracted from boost (just modified the include
style from <> to ""), there is some accessory (but useful) features which
could be deleted as the complete_type delete checker.
> > In particular, I don't see why BuilderTy in ModuleBuilder.h is
> > declared as
> > an opaque type since it represente a CodeGenModule and could simply
> > use a
> > forward declared class no?
>
> You're right, this is a clear "bug", please send in a patch!
Attached: patch1.patch
Cédric
patch1.patch
Description: Binary data
scoped_ptr.patch
Description: Binary data
_______________________________________________ cfe-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
