c++ - Naming a typedef for a boost::shared_ptr<const Foo> -


There is a silly question, but say you have square fu:

  square fu { Public: promoting typedef :: shared_ptr & lt; Foo & gt; RcPtr; Zero non_const_method () {} void const_method () const {}}; Having a Const Foo :: RcPtr does not prevent non-contact methods from being applied to a class, the following will compile:  
  #include & lt; Boost / shared_ptr.hpp & gt; Int main () {const foo :: RcPtr const_foo_ptr (new Foo); Const_foo_ptr-> Non_const_method (); Const_foo_ptr-> Const_method (); Return 0; }  

But to name the typedef ConstRcPtr means, for me, that would be typedef

  typedef const boost :: shared_ptr  

Which is not interested in me. An oder name, but maybe more accurate, RCP Trin:

  Type Type Boost: share_ptr  

However, Googling becomes zero hit for the RCTPTrun, so people do not use it as a typed name):

Have any other suggestions?

The name of the typed type, the syntax used to define its type Does not represent. The typingfed name should express its desired meaning. For example, defines the names of iterators on the const_iterator as the standard const T , even though the itater is not self const (you can still increase it) . In fact, the whole purpose of an erratitor is to change it, in order to iterate :)

  typedef T const * const_iterator;  

For indicators, I personally see some reason for stabilizing them as usually typedef, so, const can express the meaning, which the grammatists do, and will go with the current practice. So I think this is absolutely right for you and say

  typedef boost :: shared_ptr  

Basically, how does this happen? std :: allocator is also in the words


Comments