Changeset 4040


Ignore:
Timestamp:
Feb 15, 2021, 2:59:04 AM (4 months ago)
Author:
Peter
Message:

speed-up; prefer move instead of copy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/VcfHeader.cc

    r3891 r4040  
    22
    33/*
    4   Copyright (C) 2018, 2020 Peter Johansson
     4  Copyright (C) 2018, 2020, 2021 Peter Johansson
    55
    66  The yat library is free software; you can redistribute it and/or
     
    3232#include <ostream>
    3333#include <sstream>
    34 
    35 #include <iostream>
     34#include <utility>
    3635
    3736namespace theplu {
     
    6261    std::string line;
    6362    while (getline(is, line)) {
    64       lines_.push_back(line);
     63      lines_.push_back(std::move(line));
    6564      if (is.peek()!='#') // next line does not start with '#'
    6665        break;
     
    7675    line += value;
    7776    if (lines_.empty()) {
    78       lines_.push_back(line);
     77      lines_.push_back(std::move(line));
    7978      return;
    8079    }
     
    288287    std::string hdr("#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT");
    289288    if (lines_.size() &&  lines_.back().size()>1 && lines_.back()[1]!='#')
    290       lines_.back() = hdr;
     289      lines_.back() = std::move(hdr);
    291290    else
    292       lines_.push_back(hdr);
     291      lines_.push_back(std::move(hdr));
    293292
    294293    for (size_t i=0; i<s.size(); ++i) {
Note: See TracChangeset for help on using the changeset viewer.