auto_ptr in locale

Kevin Ediger kediger@licor.com
Sun Nov 21 21:42:00 GMT 1999


Nathan & Benjamin,

Here's a patch to unuglify the names.

The members were changed to pointers in locale.cc version 1.15
to remove the dependency on std_vector.h. (I'm just reading
the changelog for version 1.15, 1999-02-10)

Best Regards,
Kevin Ediger


Index: ChangeLog
===================================================================
RCS file: /cvs/libstdc++/libstdc++/ChangeLog,v
retrieving revision 1.344
diff -c -3 -p -r1.344 ChangeLog
*** ChangeLog	1999/11/19 09:09:10	1.344
--- ChangeLog	1999/11/22 05:22:39
***************
*** 1,3 ****
--- 1,8 ----
+ 1999-11-21  Kevin Ediger  <kediger@licor.com>
+ 
+ 	* src/locale.cc (locale::_Impl::_Impl): Unuglify variable names and
+ 	capitalize first letter of typedefs Vec_facet and Vec_string.
+ 
  1999-11-19  Mumit Khan  <khan@xraylith.wisc.edu>
  
          * testsuite/18_support/numeric_limits.cc: Add missing std:: prefix.
Index: src/locale.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/src/locale.cc,v
retrieving revision 1.31
diff -c -3 -p -r1.31 locale.cc
*** locale.cc	1999/11/19 01:40:32	1.31
--- locale.cc	1999/11/22 05:22:40
*************** namespace std {
*** 58,71 ****
    , _M_cached_name_ok(false)
    , _M_cached_name(string ("*"))
    { 
!     typedef vector<facet*, __STL_DEFAULT_ALLOCATOR(facet*) > __vec_facet;
!     typedef vector<string, __STL_DEFAULT_ALLOCATOR(string) > __vec_string;
  
!     auto_ptr<__vec_facet> __pvf(new __vec_facet(__numfacets, (facet*)0));
!     auto_ptr<__vec_string> __pcn(new __vec_string(_S_num_categories,
  						  string("*")));
!     _M_facets = __pvf.release();
!     _M_category_names = __pcn.release();
    }
    
    locale::_Impl::_Impl(const _Impl& __other, size_t __refs)
--- 58,71 ----
    , _M_cached_name_ok(false)
    , _M_cached_name(string ("*"))
    { 
!     typedef vector<facet*, __STL_DEFAULT_ALLOCATOR(facet*) > Vec_facet;
!     typedef vector<string, __STL_DEFAULT_ALLOCATOR(string) > Vec_string;
  
!     auto_ptr<Vec_facet> facets(new Vec_facet(__numfacets, (facet*)0));
!     auto_ptr<Vec_string> names(new Vec_string(_S_num_categories,
  						  string("*")));
!     _M_facets = facets.release();
!     _M_category_names = names.release();
    }
    
    locale::_Impl::_Impl(const _Impl& __other, size_t __refs)
*************** namespace std {
*** 76,97 ****
    , _M_cached_name_ok(__other._M_cached_name_ok)
    , _M_cached_name(__other._M_cached_name)
    {
!     typedef vector<facet*, __STL_DEFAULT_ALLOCATOR(facet*) > __vec_facet;
!     typedef vector<string, __STL_DEFAULT_ALLOCATOR(string) > __vec_string;
  
!     auto_ptr<__vec_facet> __pvf(new __vec_facet(*(__other._M_facets)));
!     auto_ptr<__vec_string> 
!       __pcn(new __vec_string(*(__other._M_category_names)));
  
!     std::vector<facet*>::iterator __it = __pvf->begin();
!     for (; __it != __pvf->end(); ++__it)
!       (*__it)->_M_add_reference();
  
      // these must be last since in the presence of an exception, the 
      // destructor for 'this' won't run until AFTER execution has passed  
      // the closing brace of the constructor
!     _M_facets = __pvf.release();
!     _M_category_names = __pcn.release();
    }
    
    void
--- 76,97 ----
    , _M_cached_name_ok(__other._M_cached_name_ok)
    , _M_cached_name(__other._M_cached_name)
    {
!     typedef vector<facet*, __STL_DEFAULT_ALLOCATOR(facet*) > Vec_facet;
!     typedef vector<string, __STL_DEFAULT_ALLOCATOR(string) > Vec_string;
  
!     auto_ptr<Vec_facet> facets(new Vec_facet(*(__other._M_facets)));
!     auto_ptr<Vec_string> 
!       names(new Vec_string(*(__other._M_category_names)));
  
!     std::vector<facet*>::iterator it = facets->begin();
!     for (; it != facets->end(); ++it)
!       (*it)->_M_add_reference();
  
      // these must be last since in the presence of an exception, the 
      // destructor for 'this' won't run until AFTER execution has passed  
      // the closing brace of the constructor
!     _M_facets = facets.release();
!     _M_category_names = names.release();
    }
    
    void


More information about the Libstdc++ mailing list