   "Renaming" std::tr1::shared_ptr
  Hey all,I was wondering if there was any way I could "rename" std::tr1::shared_ptr<T> to something of my own choosing, say Shared<T>. My first thought was along the lines of:template<typename T>class Shared<T> : public std::tr1::shared_ptr<T>{   // blah...}But then I realized that shared_ptr's destructor is not virtual, making this a no-go. Even if it was, I'd have to re-derieve shared_ptr's interface and hope I don't introduce any bugs.Should I just suck it up and use a macro? :(   
  Why do you want to?Why not just typedef on a concrete type instead?   ;  You could also pull it into your own namespace:namespace Awesome {using std::tr1::shared_ptr;}// ...Awesome::shared_ptr<int> test;Which at least avoids the need to type std::tr1:: each time you use it internally.   ;  Yeah, either pull it into the desired scopes with a "using" declaration, or typedef it on the types you want to use it with:typedef std::tr1::shared_ptr<Texture> SharedTexture;   ;Quote:Original post by phantomWhy do you want to?Why not just typedef on a concrete type instead?I could, though I've always been opposed to typedefing pointer types. When you typedef something like this, you loose the obvious indicator that this is a pointer.eg, if I see something likefunc( Texture t )I assume that t was passed by value, not by pointer. However, if I can writefunc( Shared<Texture> t )then anyone looking at the code has a good indication that t is a shared pointer pointing to type Texture.EDIT: I'll probably just using std::tr1::shared_ptr. I guess its just the OCD part of me wanting it to look "cleaner" by only having Shared<T>.   ;  You know what they say about "a foolish consistency"? The canonical example is trying to reconcile the coding styles of disparate libraries. [wink]   ;  Without templated typedefs there isn't a good way to alias templated types.You could do this:template<T>struct Shared { typedef std::tr1::shared_ptr<T> Type; };used like so:func(Shared<Texture>::Type t);The ::Type bit is ugly but necessary unfortunately, you could rename it to Ptr if you'd rather:func(Shared<Texture>::Ptr t);but then you have to wonder what that really gets you over just shared_ptr<Texture>, TexturePtr or Texture::SharedPtr.   ;  Why not use concrete names like texturePtr and meshPtr, etc.?   ;Quote:Original post by nullsquaredWhy not use concrete names like texturePtr and meshPtr, etc.?Because they are extra work for no extra benefit. At best, they're still less idiomatic than member typedefs.   ;Quote:Original post by smacdoI could, though I've always been opposed to typedefing pointer types. When you typedef something like this, you loose the obvious indicator that this is a pointer.Which is a good thing, since shared_ptr is a value type, not a pointer.   