MESSAGE
DATE | 2016-11-16 |
FROM | Ruben Safir
|
SUBJECT | Re: [Learn] Fwd: lost arguments
|
From learn-bounces-at-nylxs.com Wed Nov 16 03:30:59 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 0BD4F161312; Wed, 16 Nov 2016 03:30:59 -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 803E6160E77 for ; Wed, 16 Nov 2016 03:30:55 -0500 (EST) To: learn-at-nylxs.com References: <8a84215c-3cd2-4a1f-832b-dd80f888e205-at-googlegroups.com> From: Ruben Safir Message-ID: <8c31dfa6-200a-977a-6d9e-7087f44eb696-at-mrbrklyn.com> Date: Wed, 16 Nov 2016 03:30:55 -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: Subject: Re: [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: , Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
Check this out
std::reference_wrapper
C++
Utilities library
Function objects
std::reference_wrapper
Defined in header =
template< class T > class reference_wrapper; (since C++11) =
std::reference_wrapper is a class template that wraps a reference in a copyable, assignable object. It is frequently used as a mechanism to store references inside standard containers (like std::vector) which cannot normally hold references.
Specifically, std::reference_wrapper is a CopyConstructible and CopyAssignable wrapper around a reference to object or reference to function of type T. Instances of std::reference_wrapper are objects (they can be copied or stored in containers) but they are implicitly convertible to T&, so that they can be used as arguments with the functions that take the underlying type by reference.
Helper functions std::ref and std::cref are often used to generate std::reference_wrapper objects.
std::reference_wrapper is also used to pass objects to std::bind or to the constructor of std::thread by reference.
std::reference_wrapper is guaranteed to be TriviallyCopyable. (since C++17) Member types type definition type T result_type(deprecated in C++17) The return type of T if T is a function. Otherwise, not defined argument_type(deprecated in C++17) 1) if T is a function or pointer to function that takes one argument of type A1, then argument_type is A1.
2) if T is a pointer to member function of class T0 that takes no arguments, then argument_type is T0*, possibly cv-qualified 3) if T is a class type with a member type T::argument_type, then argument_type is an alias of that first_argument_type(deprecated in C++17) 1) if T is a function or pointer to function that takes two arguments of type s A1 and A2, then first_argument_type is A1.
2) if T is a pointer to member function of class T0 that takes one argument, then first_argument_type is T0*, possibly cv-qualified 3) if T is a class type with a member type T::first_argument_type, then first_argument_type is an alias of that second_argument_type(deprecated in C++17) 1) if T is a function or pointer to function that takes two arguments of type s A1 and A2, then second_argument_type is A2.
2) if T is a pointer to member function of class T0 that takes one argument A1, then second_argument_type is A1, possibly cv-qualified 3) if T is a class type with a member type T::second_argument_type, then second_argument_type is an alias of that Member functions (constructor) stores a reference in a new std::reference_wrapper object (public member function) operator=3D rebinds a std::reference_wrapper (public member function) getoperator T& accesses the stored reference (public member function) operator() calls the stored function (public member function) Possible implementation
template class reference_wrapper { public: // types typedef T type;
// construct/copy/destroy reference_wrapper(T& ref) noexcept : _ptr(std::addressof(ref)) {} reference_wrapper(T&&) =3D delete; reference_wrapper(const reference_wrapper&) noexcept =3D default;
// assignment reference_wrapper& operator=3D(const reference_wrapper& x) noexcept =3D default;
// access operator T& () const noexcept { return *_ptr; } T& get() const noexcept { return *_ptr; }
template< class... ArgTypes > typename std::result_of::type operator() ( ArgTypes&&... args ) const { return std::invoke(get(), std::forward(args)...); }
private: T* _ptr; };
Example
Demonstrates the use of reference_wrapper as a container of references, which makes it possible to access the same container using multiple indexes Run this code
#include #include #include #include #include #include #include
int main() { std::list l(10); std::iota(l.begin(), l.end(), -4);
std::vector> v(l.begin(), l.end()); // can't use shuffle on a list (requires random access), but can use it on a vector std::shuffle(v.begin(), v.end(), std::mt19937{std::random_device{}()});
std::cout << "Contents of the list: "; for (int n : l) std::cout << n << ' '; std::cout << '\n';
std::cout << "Contents of the list, as seen through a shuffled vector: "; for (int i : v) std::cout << i << ' '; std::cout << '\n';
std::cout << "Doubling the values in the initial list...\n"; for (int& i : l) { i *=3D 2; }
std::cout << "Contents of the list, as seen through a shuffled vector: "; for (int i : v) std::cout << i << ' '; std::cout << '\n'; }
Possible output:
Contents of the list: -4 -3 -2 -1 0 1 2 3 4 5 Contents of the list, as seen through a shuffled vector: -1 2 -2 1 5 0 3 -3 -4 4 Doubling the values in the initial list... Contents of the list, as seen through a shuffled vector: -2 4 -4 2 10 0 6 -6 -8 8
See also refcref (C++11)(C++11) creates a std::reference_wrapper with a type deduced from its argument (function template) bind (C++11) binds one or more arguments to a function object (function template)
On 11/09/2016 10:48 AM, ruben safir wrote: > /* > * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > * > * 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 =
> * > * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > */ > #ifndef NODES_H > #define NODES_H > #include > #include > #include > namespace tree { > =
> =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > * Class NODE - =
> * Description - This is a node in the tree that must undergo parsimony e= valuation > * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D > */ > template > class NODE{ > public: > //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3DLIFECYCLE=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > /* Constructor */ > NODE( std::string xt, const unk &x , NODE *xcl=3D 0, NODE *x= cr =3D 0, NODE *xp =3D 0 ); > //NODE( std::string xt, unk &x , NODE *xcl=3D 0, NODE *xcr = =3D 0, NODE *xp =3D 0 ); > ~NODE(); > =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D AC= CESSORS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > //no need for inline when you are defineing functions within the class de= finition > 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 =3D x; > } > void trait(std::string xt){ > _trait =3D 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 =3D xcl; > } > void cr(NODE *xcr){//This is the right node child node in the tree > _cr =3D xcr; > } > void p(NODE *xp){//This is the parent node in the tree > _p =3D xp; > } > /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D MU= TATORS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D OP= ERATORS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > //void display(); =
> template > friend std::ostream& operator<<(std::ostream& os, const T&); > =
> template > friend std::ostream& operator<<(std::ostream& os, const NODE &); > =
> protected: > /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D DA= TA MEMBERS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > =
> =
> private: > /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D DA= TA MEMBERS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > 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 =3D> " << = std::endl; > } > =
> //template > //NODE::NODE( std::string xt, unk &x, NODE *xcl , NODE *xc= r, NODE *xp ){ > // states(x); > // trait(xt); > // cl(xcl); > // cr(xcr); > // p(xp); > // std::cout << trait() << " node " << "has the following states =3D> " <= < std::endl; > //} > =
> =
> template > tree::NODE::~NODE(){ > } > =
> /* > * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > * Class: State > * Description: This describes a possible individual state or charactor= istic =
> * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > */ > template > class state > { > public: > /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D LIFECY= CLE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > /* constructor */ > //r is the minimum cost of a single state when compared to the child no= des > explicit state(std::string const xa, cost xr) =
> :_nam{xa}, _r{xr} > { > std::cout << "Building a state pair" << std::endl; > std::cout << "nam =3D> " << nam() << "\tcost=3D> " << r() << std::end= l; > }; > =
> =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ACCESS= ORS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > std::string nam(){return _nam;}; > cost r(){return _r;}; > void r(cost b ){_r =3D b;}; =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D MUTATO= RS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D OPERAT= ORS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D DATA M= EMBERS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > protected: > =
> private: > std::string _nam; > cost _r; > =
> }; /* ----- end of class State ----- */ > =
> /* > * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > * Class: Pstates > * Description: vector of all possible states > * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > */ > template > class Pstates > { > public: > =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D LIFECY= CLE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > /* constructor */ > Pstates (std::vector< state > x) > : _vstate{x} > { > for( auto& y : _vstate) > std::cout << y << std::endl; > }; > =
> // Pstates() > // : _vstate{0} > // {}; > =
> ~Pstates (){}; /* destructor */ > =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ACCESS= ORS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > const std::vector< state >& vstate(){ > return _vstate; > } > void vstate(std::vector< state > in ){ > _vstate =3D in; > } > =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D MUTATO= RS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D OPERAT= ORS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > =
> const Pstates& operator =3D ( const Pstates &other ); /* assignment ope= rator */ > =
> =
> =
> =
> /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D DATA M= EMBERS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ > protected: > =
> private: > std::vector< state > _vstate; > =
> }; /* ----- end of class Pstates ----- */ > =
> /* Overload ostream function */ > template > std::ostream& operator << ( std::ostream &output, state &p ) =
> { =
> output << "nam =3D> " << p.nam() << "\tcost=3D> " << p.r() << std::en= dl; > return output; =
> } > =
> /* > =
> =
> template > inline unk NODE::value(){ if(this !=3D NULL) return _value; else ret= urn NULL; }; > =
> template > inline void NODE::value(unk val){ > _value =3D 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 =3D cout); > void remove_front(); > void remove_all(); > void remove_item(unk); > void remove_item(NODE *); > NODE * find(unk); > NODE * find_all(unk, NODE * last =3D NULL ); > =
> ~LIST(); > =
> private: > NODE *_at_front; > NODE *_at_end; > int _size; > LIST(const LIST&); > LIST& operator=3D( const LIST&); > }; > */ > =
> /* > template > void LIST::display(ostream &os){ > NODE * tmp =3D _at_front; > =
> if (tmp =3D=3D 0){ > os << "No List" << endl; > return; > } > =
> =
> //unk i =3D0; > while(tmp !=3D _at_end){ > //cout << "Entering While Loop: "<< ++i << endl; > os << tmp->value() << ":"; > tmp =3D 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 =3D {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 =91tree::NODE::NODE(std::__cxx11::st= ring, const unk&, tree::NODE*, tree::NODE*, tree::NODE*) [wi= th unk =3D tree::Pstates; std::__cxx11::string =3D std::__cxx11::basic= _string]=92: > fitch.cpp|22 col 55| required from here > nodes.h|105 col 96| error: no matching function for call to =91tree::Psta= tes::Pstates()=92 > || NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE<= unk> *xcr, NODE *xp ){ > || = ^ > nodes.h|180 col 3| note: candidate: tree::Pstates::Pstates(std::vec= tor >) [with cost =3D 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 tre= e::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 =91tree::Psta= tes::Pstates()=92 > || NODE::NODE( std::string xt, const unk &x, NODE *xcl , NODE<= unk> *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 =3D> " << = std::endl; > } > =
> it is not supposed to call Pstates::Pstates() > =
> I'm specifically sending the argument by reference. It is not supposed t= o be constructing a thing. > =
> =
> =
> _______________________________________________ > Learn mailing list > Learn-at-nylxs.com > http://lists.mrbrklyn.com/mailman/listinfo/learn > =
-- =
So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013 _______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|