Giter Club home page Giter Club logo

Comments (1)

vflorelo avatar vflorelo commented on July 30, 2024

I am no expert in C++ but this fixed my installation

Original code:

		if (line.find("Median insert size") != string::npos) {
			rg = get_rg(line);
			getline(isf, line);
			double val = strtod(line.c_str(), NULL);
			map< string, pair<double,double> >::iterator iter =
				isinfo.find(rg);
			if (iter != isinfo.end())
				isinfo[rg].first = val;
			else
				isinfo[rg] = make_pair<double,double>(val, 0);
		} else if (line.find("Standard deviation of insert size") != string::npos) {
			rg = get_rg(line);
			getline(isf, line);
			double val = strtod(line.c_str(), NULL);
			map< string, pair<double,double> >::iterator iter =
				isinfo.find(rg);
			if (iter != isinfo.end())
				isinfo[rg].second = val;
			else
				isinfo[rg] = make_pair<double,double>(0, val);
		}

Patch:

		if (line.find("Median insert size") != string::npos) {
			rg = get_rg(line);
			getline(isf, line);
			double val = strtod(line.c_str(), NULL);
			map< string, pair<double,double> >::iterator iter =
				isinfo.find(rg);
			if (iter != isinfo.end())
				isinfo[rg].first = val;
			else
				isinfo[rg] = make_pair<double&,double>(val, 0);
		} else if (line.find("Standard deviation of insert size") != string::npos) {
			rg = get_rg(line);
			getline(isf, line);
			double val = strtod(line.c_str(), NULL);
			map< string, pair<double,double> >::iterator iter =
				isinfo.find(rg);
			if (iter != isinfo.end())
				isinfo[rg].second = val;
			else
				isinfo[rg] = make_pair<double,double&>(0, val);
		}

Nothe the ampersand in the function call make_pair

From stack overflow:
https://stackoverflow.com/questions/7388889/whats-a-variable-with-double

It's a reference. That means that whatever you set the value to inside the function, the original variable that was passed in from outside will have that value.

But in the function make_pair, the variable val was not being called by reference

from software-issues.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.