Changeset 4210


Ignore:
Timestamp:
Aug 30, 2022, 11:51:51 AM (5 months ago)
Author:
Peter
Message:

avoid accessing vector element out of bounds when length is 1; prefer moving over copying data.

Location:
branches/0.20-stable/yat/omic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.20-stable/yat/omic/GFF2.cc

    r3875 r4210  
    5353      --n;
    5454    // str[n] now points to last char we want to include
    55     m[key] = str.substr(i,n-i+1);
     55    m[std::move(key)] = str.substr(i,n-i+1);
    5656  }
    5757
  • branches/0.20-stable/yat/omic/GFF3.cc

    r3875 r4210  
    4242      if (v[0] == "")
    4343        return;
    44       m[v[0]] = "";
     44      m[std::move(v[0])] = "";
    4545    }
    46     m[v[0]] = v[1];
     46    else
     47      m[std::move(v[0])] = std::move(v[1]);
    4748  }
    4849
Note: See TracChangeset for help on using the changeset viewer.