mynode_imp.cpp

来自「支持简单的公式推导」· C++ 代码 · 共 52 行

CPP
52
字号
#include "stdafx.h"
#include "mynode.h"



Node::Node(const string& name):expression_(name),is_const_(false),value_(0)
{}

Node::Node(double c):value_(c),is_const_(true),expression_("")
{
	//cout<<"c->Node called\n";
}

Node::Node(const Operand& o)
:value_(o.GetSingleValue()),expression_(o.GetExpression()),is_const_(o.IsConst())
{}

Node::~Node()
{}

bool Node::operator<(const Node& in)const
{      
	
/*	if (IsConst()) // i am a const
	{
		if (in.IsConst())
			return GetResult() < in.GetResult();
		// c - c
		else
			return true;
		//c - f 
	}
	else  // i am factor
	{
		if (!in.IsConst())               
			return GetExpression() < in.GetExpression();
		// f - f
		else
			return false;
		// f - c
	}*/
	return expression_ < in.expression_;
	//认为所有的常数是相等的
	//居然在这里出现了bug!!!!!!!!!!!
}






⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?