Skip to content
  • Mark OLESEN's avatar
    ENH: refine PtrList emplace method, add emplace for autoPtr/refPtr... · 63258d0b
    Mark OLESEN authored
    * resize_null() methods for PtrList variants
      - for cases where an existing PtrList needs a specific size and
        but not retain any existing entries.
    
        Eg,
            ptrs.resize_null(100);
    
        vs.   ptrs.free();     ptr.resize(100);
        or    ptr.resize(100); ptrs.free();
    
    * remove stored pointer before emplacing PtrList elements
      - may reduce memory peaks
    
    * STYLE: static_cast of (nullptr) instead of reinterpret_cast of (0)
    
    * COMP: implement emplace_set() for PtrDynList
      - previously missing, which meant it would have leaked through to the
        underlying PtrList definition
    
    * emplace methods for autoPtr, refPtr, tmp
      - applies reset() with forwarding arguments.
        For example,
    
            tmp<GeoField> tfld = ...;
    
        later...
    
            tfld.emplace(io, mesh);
    
        vs.
            tfld.reset(new GeoField(io, mesh));
        or
            tfld.reset(tmp<GeoField>::New(io, mesh));
    
        The emplace() obviously has reduced typing, but also allo...
    63258d0b