MESSAGE
DATE | 2016-11-09 |
FROM | ruben safir
|
SUBJECT | Subject: [Learn] Fwd: lost arguments
|
From learn-bounces-at-nylxs.com Wed Nov 9 10:48:50 2016 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 45802161316; Wed, 9 Nov 2016 10:48:50 -0500 (EST) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from [10.0.0.62] (flatbush.mrbrklyn.com [10.0.0.62]) by mrbrklyn.com (Postfix) with ESMTP id 43C28160E77; Wed, 9 Nov 2016 10:48:44 -0500 (EST) References: <8a84215c-3cd2-4a1f-832b-dd80f888e205-at-googlegroups.com> To: learn-at-nylxs.com, hangout From: ruben safir X-Forwarded-Message-Id: <8a84215c-3cd2-4a1f-832b-dd80f888e205-at-googlegroups.com> Message-ID: Date: Wed, 9 Nov 2016 10:48:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------2691CC75CA61C8126A382F99" Subject: [Learn] Fwd: lost arguments X-BeenThere: learn-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
This is a multi-part message in MIME format. --------------2691CC75CA61C8126A382F99 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit
/* * ===================================================================================== * * Filename: nodes.h * * Description: description of phylogentic nodes as per * Fitch and Sannkoff as describd by Felenstein * * Version: 1.0 * Created: Nov 4 21:15:49 EDT 2016 * Revision: none * Compiler: gcc * * Author: Ruben Safir, * Company: LIU Thesis * * ===================================================================================== */ #ifndef NODES_H #define NODES_H #include #include #include namespace tree {
/* ============================================================================== * Class NODE - * Description - This is a node in the tree that must undergo parsimony evaluation * ================================================================================ */ template class NODE{ public: //=========================LIFECYCLE========================================= /* Constructor */ NODE( std::string xt, const unk &x , NODE *xcl= 0, NODE *xcr = 0, NODE *xp = 0 ); //NODE( std::string xt, unk &x , NODE *xcl= 0, NODE *xcr = 0, NODE *xp = 0 ); ~NODE(); /* ==================== ACCESSORS ======================================= */ //no need for inline when you are defineing functions within the class definition std::string trait()const{ return _trait; } unk states()const{ return _states; }; NODE * cl()const{ return _cl; }; NODE * cr()const{ return _cr; }; NODE * p()const{ return _p; }; void states(const unk &x){ _states = x; } void trait(std::string xt){ _trait = xt; //With genetics this is a A C G T although it is just a label } void cl(NODE *xcl){ //This is the left child node in the tree _cl = xcl; } void cr(NODE *xcr){//This is the right node child node in the tree _cr = xcr; } void p(NODE *xp){//This is the parent node in the tree _p = xp; } /* ==================== MUTATORS ======================================= */ /* ==================== OPERATORS ======================================= */ //void display(); template friend std::ostream& operator<<(std::ostream& os, const T&);
template friend std::ostream& operator<<(std::ostream& os, const NODE &);
protected: /* ==================== DATA MEMBERS ======================================= */ private: /* ==================== DATA MEMBERS ======================================= */ std::string _trait; unk _states; NODE * _cl, * _cr, * _p;
}; /* ----- end of template class NODE ----- */
template std::ostream& operator<<(std::ostream& os, const NODE& vec){
for( auto& y : vec.state() ) os << y << std::endl; return os; }
template NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE *xcr, NODE *xp ){ states(x); trait(xt); cl(xcl); cr(xcr); p(xp); std::cout << trait() << " node " << "has the following states => " << std::endl; }
//template //NODE::NODE( std::string xt, unk &x, NODE *xcl , NODE *xcr, NODE *xp ){ // states(x); // trait(xt); // cl(xcl); // cr(xcr); // p(xp); // std::cout << trait() << " node " << "has the following states => " << std::endl; //}
template tree::NODE::~NODE(){ }
/* * ===================================================================================== * Class: State * Description: This describes a possible individual state or charactoristic * ===================================================================================== */ template class state { public: /* ==================== LIFECYCLE ======================================= */ /* constructor */ //r is the minimum cost of a single state when compared to the child nodes explicit state(std::string const xa, cost xr) :_nam{xa}, _r{xr} { std::cout << "Building a state pair" << std::endl; std::cout << "nam => " << nam() << "\tcost=> " << r() << std::endl; };
/* ==================== ACCESSORS ======================================= */ std::string nam(){return _nam;}; cost r(){return _r;}; void r(cost b ){_r = b;}; /* ==================== MUTATORS ======================================= */
/* ==================== OPERATORS ======================================= */
/* ==================== DATA MEMBERS ======================================= */ protected:
private: std::string _nam; cost _r;
}; /* ----- end of class State ----- */
/* * ===================================================================================== * Class: Pstates * Description: vector of all possible states * ===================================================================================== */ template class Pstates { public:
/* ==================== LIFECYCLE ======================================= */ /* constructor */ Pstates (std::vector< state > x) : _vstate{x} { for( auto& y : _vstate) std::cout << y << std::endl; };
// Pstates() // : _vstate{0} // {};
~Pstates (){}; /* destructor */
/* ==================== ACCESSORS ======================================= */ const std::vector< state >& vstate(){ return _vstate; } void vstate(std::vector< state > in ){ _vstate = in; }
/* ==================== MUTATORS ======================================= */
/* ==================== OPERATORS ======================================= */
const Pstates& operator = ( const Pstates &other ); /* assignment operator */
/* ==================== DATA MEMBERS ======================================= */ protected:
private: std::vector< state > _vstate;
}; /* ----- end of class Pstates ----- */
/* Overload ostream function */ template std::ostream& operator << ( std::ostream &output, state &p ) { output << "nam => " << p.nam() << "\tcost=> " << p.r() << std::endl; return output; }
/*
template inline unk NODE::value(){ if(this != NULL) return _value; else return NULL; };
template inline void NODE::value(unk val){ _value = val; };
*/
/* template class LIST{ public: LIST() : _at_front(0), _at_end(0), _size(0) {} inline int size(); inline void insert(NODE *, unk); inline void insert(unk); inline void front(unk); inline void up_size(); inline void down_size(); void display(ostream &os = cout); void remove_front(); void remove_all(); void remove_item(unk); void remove_item(NODE *); NODE * find(unk); NODE * find_all(unk, NODE * last = NULL );
~LIST();
private: NODE *_at_front; NODE *_at_end; int _size; LIST(const LIST&); LIST& operator=( const LIST&); }; */
/* template void LIST::display(ostream &os){ NODE * tmp = _at_front;
if (tmp == 0){ os << "No List" << endl; return; }
//unk i =0; while(tmp != _at_end){ //cout << "Entering While Loop: "<< ++i << endl; os << tmp->value() << ":"; tmp = tmp->next(); }
os << tmp->value() << endl;
} */ } /*---End of Namespace TREE---*/ #endif
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include #include #include "nodes.h" using namespace std;
int main(int argv, char ** argc) { tree::state a{"A", 65500}; tree::state c{"C", 0}; tree::state g{"G", 65500}; tree::state t{"T", 65500};
vector< tree::state > posible_states = {a,c,g,t};
tree::Pstates node_status{posible_states}; tree::NODE cr1{"T01", 3}; tree::NODE cl1{"T00",2}; // tree::NODE root{"T0",1};
// tree::NODE > cr1{"T01", 3}; // tree::NODE > cl1{"T00",2}; tree::NODE > root{"T0",node_status}; return 0; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ when this compiles and reaches the last construction it loses parameters
|| g++ -Wall -ggdb -c nodes.cpp || g++ -Wall -ggdb -o fitch.o -c fitch.cpp || nodes.h: In instantiation of ‘tree::NODE::NODE(std::__cxx11::string, const unk&, tree::NODE*, tree::NODE*, tree::NODE*) [with unk = tree::Pstates; std::__cxx11::string = std::__cxx11::basic_string]’: fitch.cpp|22 col 55| required from here nodes.h|105 col 96| error: no matching function for call to ‘tree::Pstates::Pstates()’ || NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE *xcr, NODE *xp ){ || ^ nodes.h|180 col 3| note: candidate: tree::Pstates::Pstates(std::vector >) [with cost = int] || Pstates (std::vector< state > x) || ^~~~~~~ nodes.h|180 col 3| note: candidate expects 1 argument, 0 provided nodes.h|174 col 7| note: candidate: tree::Pstates::Pstates(const tree::Pstates&) || class Pstates || ^~~~~~~ nodes.h|174 col 7| note: candidate expects 1 argument, 0 provided make: *** [makefile|10| fitch.o] Error 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
specifically right here... fitch.cpp|22 col 55| required from here nodes.h|105 col 96| error: no matching function for call to ‘tree::Pstates::Pstates()’ || NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE *xcr, NODE *xp ){
template NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE *xcr, NODE *xp ){ states(x); trait(xt); cl(xcl); cr(xcr); p(xp); std::cout << trait() << " node " << "has the following states => " << std::endl; }
it is not supposed to call Pstates::Pstates()
I'm specifically sending the argument by reference. It is not supposed to be constructing a thing.
--------------2691CC75CA61C8126A382F99 Content-Type: message/rfc822; name="lost arguments.eml" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="lost arguments.eml"
Path: reader2.panix.com!panix!not-for-mail From: Popping mad Newsgroups: comp.lang.c++ Subject: lost arguments Date: Tue, 8 Nov 2016 21:15:59 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: NNTP-Posting-Host: www.mrbrklyn.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader2.panix.com 1478639759 1999 96.57.23.82 (8 Nov 2016 21:15:59 GMT) X-Complaints-To: abuse-at-panix.com NNTP-Posting-Date: Tue, 8 Nov 2016 21:15:59 +0000 (UTC) User-Agent: Pan/0.140 (Chocolate Salty Balls; GIT b8fc14e git.gnome.org/git/pan2) Xref: panix comp.lang.c++:1125131
/* * ===================================================================================== * * Filename: nodes.h * * Description: description of phylogentic nodes as per * Fitch and Sannkoff as describd by Felenstein * * Version: 1.0 * Created: Nov 4 21:15:49 EDT 2016 * Revision: none * Compiler: gcc * * Author: Ruben Safir, * Company: LIU Thesis * * ===================================================================================== */ #ifndef NODES_H #define NODES_H #include #include #include namespace tree {
/* ============================================================================== * Class NODE - * Description - This is a node in the tree that must undergo parsimony evaluation * ================================================================================ */ template class NODE{ public: //=========================LIFECYCLE========================================= /* Constructor */ NODE( std::string xt, const unk &x , NODE *xcl= 0, NODE *xcr = 0, NODE *xp = 0 ); //NODE( std::string xt, unk &x , NODE *xcl= 0, NODE *xcr = 0, NODE *xp = 0 ); ~NODE(); /* ==================== ACCESSORS ======================================= */ //no need for inline when you are defineing functions within the class definition std::string trait()const{ return _trait; } unk states()const{ return _states; }; NODE * cl()const{ return _cl; }; NODE * cr()const{ return _cr; }; NODE * p()const{ return _p; }; void states(const unk &x){ _states = x; } void trait(std::string xt){ _trait = xt; //With genetics this is a A C G T although it is just a label } void cl(NODE *xcl){ //This is the left child node in the tree _cl = xcl; } void cr(NODE *xcr){//This is the right node child node in the tree _cr = xcr; } void p(NODE *xp){//This is the parent node in the tree _p = xp; } /* ==================== MUTATORS ======================================= */ /* ==================== OPERATORS ======================================= */ //void display(); template friend std::ostream& operator<<(std::ostream& os, const T&);
template friend std::ostream& operator<<(std::ostream& os, const NODE &);
protected: /* ==================== DATA MEMBERS ======================================= */ private: /* ==================== DATA MEMBERS ======================================= */ std::string _trait; unk _states; NODE * _cl, * _cr, * _p;
}; /* ----- end of template class NODE ----- */
template std::ostream& operator<<(std::ostream& os, const NODE& vec){
for( auto& y : vec.state() ) os << y << std::endl; return os; }
template NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE *xcr, NODE *xp ){ states(x); trait(xt); cl(xcl); cr(xcr); p(xp); std::cout << trait() << " node " << "has the following states => " << std::endl; }
//template //NODE::NODE( std::string xt, unk &x, NODE *xcl , NODE *xcr, NODE *xp ){ // states(x); // trait(xt); // cl(xcl); // cr(xcr); // p(xp); // std::cout << trait() << " node " << "has the following states => " << std::endl; //}
template tree::NODE::~NODE(){ }
/* * ===================================================================================== * Class: State * Description: This describes a possible individual state or charactoristic * ===================================================================================== */ template class state { public: /* ==================== LIFECYCLE ======================================= */ /* constructor */ //r is the minimum cost of a single state when compared to the child nodes explicit state(std::string const xa, cost xr) :_nam{xa}, _r{xr} { std::cout << "Building a state pair" << std::endl; std::cout << "nam => " << nam() << "\tcost=> " << r() << std::endl; };
/* ==================== ACCESSORS ======================================= */ std::string nam(){return _nam;}; cost r(){return _r;}; void r(cost b ){_r = b;}; /* ==================== MUTATORS ======================================= */
/* ==================== OPERATORS ======================================= */
/* ==================== DATA MEMBERS ======================================= */ protected:
private: std::string _nam; cost _r;
}; /* ----- end of class State ----- */
/* * ===================================================================================== * Class: Pstates * Description: vector of all possible states * ===================================================================================== */ template class Pstates { public:
/* ==================== LIFECYCLE ======================================= */ /* constructor */ Pstates (std::vector< state > x) : _vstate{x} { for( auto& y : _vstate) std::cout << y << std::endl; };
// Pstates() // : _vstate{0} // {};
~Pstates (){}; /* destructor */
/* ==================== ACCESSORS ======================================= */ const std::vector< state >& vstate(){ return _vstate; } void vstate(std::vector< state > in ){ _vstate = in; }
/* ==================== MUTATORS ======================================= */
/* ==================== OPERATORS ======================================= */
const Pstates& operator = ( const Pstates &other ); /* assignment operator */
/* ==================== DATA MEMBERS ======================================= */ protected:
private: std::vector< state > _vstate;
}; /* ----- end of class Pstates ----- */
/* Overload ostream function */ template std::ostream& operator << ( std::ostream &output, state &p ) { output << "nam => " << p.nam() << "\tcost=> " << p.r() << std::endl; return output; }
/*
template inline unk NODE::value(){ if(this != NULL) return _value; else return NULL; };
template inline void NODE::value(unk val){ _value = val; };
*/
/* template class LIST{ public: LIST() : _at_front(0), _at_end(0), _size(0) {} inline int size(); inline void insert(NODE *, unk); inline void insert(unk); inline void front(unk); inline void up_size(); inline void down_size(); void display(ostream &os = cout); void remove_front(); void remove_all(); void remove_item(unk); void remove_item(NODE *); NODE * find(unk); NODE * find_all(unk, NODE * last = NULL );
~LIST();
private: NODE *_at_front; NODE *_at_end; int _size; LIST(const LIST&); LIST& operator=( const LIST&); }; */
/* template void LIST::display(ostream &os){ NODE * tmp = _at_front;
if (tmp == 0){ os << "No List" << endl; return; }
//unk i =0; while(tmp != _at_end){ //cout << "Entering While Loop: "<< ++i << endl; os << tmp->value() << ":"; tmp = tmp->next(); }
os << tmp->value() << endl;
} */ } /*---End of Namespace TREE---*/ #endif
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include #include #include "nodes.h" using namespace std;
int main(int argv, char ** argc) { tree::state a{"A", 65500}; tree::state c{"C", 0}; tree::state g{"G", 65500}; tree::state t{"T", 65500};
vector< tree::state > posible_states = {a,c,g,t};
tree::Pstates node_status{posible_states}; tree::NODE cr1{"T01", 3}; tree::NODE cl1{"T00",2}; // tree::NODE root{"T0",1};
// tree::NODE > cr1{"T01", 3}; // tree::NODE > cl1{"T00",2}; tree::NODE > root{"T0",node_status}; return 0; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ when this compiles and reaches the last construction it loses parameters
|| g++ -Wall -ggdb -c nodes.cpp || g++ -Wall -ggdb -o fitch.o -c fitch.cpp || nodes.h: In instantiation of ‘tree::NODE::NODE(std::__cxx11::string, const unk&, tree::NODE*, tree::NODE*, tree::NODE*) [with unk = tree::Pstates; std::__cxx11::string = std::__cxx11::basic_string]’: fitch.cpp|22 col 55| required from here nodes.h|105 col 96| error: no matching function for call to ‘tree::Pstates::Pstates()’ || NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE *xcr, NODE *xp ){ || ^ nodes.h|180 col 3| note: candidate: tree::Pstates::Pstates(std::vector >) [with cost = int] || Pstates (std::vector< state > x) || ^~~~~~~ nodes.h|180 col 3| note: candidate expects 1 argument, 0 provided nodes.h|174 col 7| note: candidate: tree::Pstates::Pstates(const tree::Pstates&) || class Pstates || ^~~~~~~ nodes.h|174 col 7| note: candidate expects 1 argument, 0 provided make: *** [makefile|10| fitch.o] Error 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
specifically right here... fitch.cpp|22 col 55| required from here nodes.h|105 col 96| error: no matching function for call to ‘tree::Pstates::Pstates()’ || NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE *xcr, NODE *xp ){
template NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE *xcr, NODE *xp ){ states(x); trait(xt); cl(xcl); cr(xcr); p(xp); std::cout << trait() << " node " << "has the following states => " << std::endl; }
it is not supposed to call Pstates::Pstates()
I'm specifically sending the argument by reference. It is not supposed to be constructing a thing.
--------------2691CC75CA61C8126A382F99 Content-Type: message/rfc822; name="Re: lost arguments.eml" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Re: lost arguments.eml"
Path: reader2.panix.com!panix!goblin2!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: red floyd Newsgroups: comp.lang.c++ Subject: Re: lost arguments Date: Tue, 8 Nov 2016 23:22:40 -0800 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 9 Nov 2016 07:22:15 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="7d72722b00eb87eb7c79bc0b74f9aa77"; logging-data="28517"; mail-complaints-to="abuse-at-eternal-september.org"; posting-account="U2FsdGVkX1++mHg4Mac2BuT8XQZU3/TcV7wK2m34HBM=" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 In-Reply-To: Cancel-Lock: sha1:ZHOsRcEHLz9bSxjWSx0pjaYGy+E= Xref: panix comp.lang.c++:1125138
On 11/8/2016 1:15 PM, Popping mad wrote:
> template > NODE::NODE( std::string xt, const unk &x, NODE | |