What's your convention for typedef'ing shared_ptr?

后端 未结 16 1715
北恋
北恋 2020-12-13 00:10

I\'m flip-flopping between naming conventions for typedef\'ing the boost::shared_ptr template. For example:

typedef boost::shared_ptr FooPtr;
         


        
16条回答
  •  忘掉有多难
    2020-12-13 00:28

    My first response is to ask, "Why typedef that?"

    In reply to your edit: Actually that's a rather interesting approach that could be useful in many situations. Using it to go back to your original question you might have:

    
    struct object
    {
      typedef object* ptr_t;
      typedef shared_ptr shared_ptr_t;
      typedef weak_ptr weak_ptr_t;
      typedef unique_ptr unique_ptr_t;
      etc...
    }
    
        

    提交回复
    热议问题