MESSAGE
DATE | 2016-11-08 |
FROM | Christopher League
|
SUBJECT | Re: [Learn] C++ signature ambiguity
|
From learn-bounces-at-nylxs.com Tue Nov 8 15:36:41 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 94B61161312; Tue, 8 Nov 2016 15:36:41 -0500 (EST) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from liucs.net (contrapunctus.net [174.136.110.10]) by mrbrklyn.com (Postfix) with ESMTP id C0A01160E77 for ; Tue, 8 Nov 2016 15:36:39 -0500 (EST) Received: from localhost (pool-74-101-138-109.nycmny.fios.verizon.net [74.101.138.109]) by liucs.net (Postfix) with ESMTPSA id A7754E097; Tue, 8 Nov 2016 15:36:37 -0500 (EST) From: Christopher League To: learn-at-nylxs.com, Mohammed Ghriga In-Reply-To: References: User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/25.1.1 (x86_64-unknown-linux-gnu) Date: Tue, 08 Nov 2016 15:36:34 -0500 Message-ID: <87r36logj1.fsf-at-contrapunctus.net> MIME-Version: 1.0 Subject: Re: [Learn] C++ signature ambiguity 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: multipart/mixed; boundary="===============2121920907==" Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
--===============2121920907== Content-Type: multipart/signed; boundary="===-=-="; micalg=pgp-sha256; protocol="application/pgp-signature"
--===-=-= Content-Type: multipart/mixed; boundary="=-=-="
--=-=-= Content-Type: multipart/alternative; boundary="==-=-="
--==-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable
Unclear to me why one might need both, but I tried removing the reference version and it died with a similar error somewhere else. Maybe I just needed to push the change further, into member classes.
I think it's perfectly fine to decide either that every generic type parameter is a pointer (what Java does), or that it's passed by value... and then the client code can specify it either as `foo` if it expects copies, or `foo` if it expects dynamic allocation. The duplication of supporting every variation of `T`, `T&`, `const T&`, and `const T& const` (is that a thing?) is damn annoying.
CL
Ruben Safir writes:
> I need to separate these two method signatures=20 > > > #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; > } > > > > 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, unk &x , NODE *xcl=3D 0, NODE *xcr =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(); >=20=20=20=20=20=20=20 > > > I'm open to ideas > > > http://www.nylxs.com/docs/thesis/src/fitch/fitch.tgz > is the code > > > --=20 > 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=20 > > 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
--==-=-= Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
1.0, user-scalable=3Dyes">
Unclear to me why one might need both, but I tried removing the referenc= e version and it died with a similar error somewhere else. Maybe I just nee= ded to push the change further, into member classes.
I think it=E2=80=99s perfectly fine to decide either that every generic = type parameter is a pointer (what Java does), or that it=E2=80=99s passed b= y value=E2=80=A6 and then the client code can specify it either as fo= o<T> if it expects copies, or foo<T*> if it= expects dynamic allocation. The duplication of supporting every variation = of T , T& , const T& , and e>const T& const (is that a thing?) is damn annoying.
CL
Ruben Safir ruben-at-mrbrklyn.com= writes:
I need to separate these two method signatures
include
include
include =E2=80=9Cnodes.h=E2=80=9D
using namespace std;
int main(int argv, char ** argc) { tree::state a{=E2=80=9CA=E2=80= =9D, 65500}; tree::state c{=E2=80=9CC=E2=80=9D, 0}; tree::state g= {=E2=80=9CG=E2=80=9D, 65500}; tree::state t{=E2=80=9CT=E2=80=9D, 65500= };
vector< tree::state > posible_states =3D {a,c,g,t};
tree::Pstates node_status{posible_states}; tree::NODE cr1{=E2= =80=9CT01=E2=80=9D, 3}; tree::NODE cl1{=E2=80=9CT00=E2=80=9D,2}; // tr= ee::NODE root{=E2=80=9CT0=E2=80=9D,1};
// tree::NODE > cr1{=E2=80=9CT01=E2=80=9D, 3}; // tree::= NODE > cl1{=E2=80=9CT00=E2=80=9D,2}; tree::NODEes > root{=E2=80=9CT0=E2=80=9D,node_status}; return 0; }
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, unk = &x , NODE xcl=3D 0, NODE xcr =3D 0, NODE x= p =3D 0 ); NODE( std::string xt, unk x , NODE xcl=3D 0, NODE = xcr =3D 0, NODE *xp =3D 0 ); ~NODE();
I=E2=80=99m open to ideas
http://www.nylxs.com/docs/thesis/src/fitch/fitch.tgz is the code
=E2=80=93 So many immigrant groups have swept through our town that Broo= klyn, like Atlantis, reaches mythological proportions in the mind of the wo= rld - 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/reso= urces - Unpublished Archive http://www.coinhangout.com - coins! http://www.= brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but in= compatible with living as a free human being. -RI Safir 2013 ______________= _________________________________ Learn mailing list Learn-at-nylxs.com http:/= /lists.mrbrklyn.com/mailman/listinfo/learn
--==-=-=--
--=-=-=--
--===-=-= Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQEcBAEBCAAGBQJYIjdSAAoJEGuLsz1PMbCLWgwH/1knXUwJyg4LF3dQ+0NcTr12 TvPgVpTxc0L1i8msmOa7Ek7SvjhjZ1tnFxsfHLUg7xKsAaqmaLxeR/CWbzmN/OBQ KXlR3JuNVr1GtZv/QEBeRKEk4v8XZSr2XQWje3VP26UtdTcGVyJAOuEEd6oclohW m9gXXLxsBunXOzg82e8WgdAUR3IE+tKJSWxqsvmQcU6qVphXrEvJ2+euzVh/A7eH 8uFpIwAuj/1siwbXD22xMnyKjSfqMBrCEGrWAZ4jMquGOz/BUzjF/LydPmRvMB9F xDpavpUxlcm5OimWJnxSWPrMxJcfJI4t85QvHx/5JUlNI8c52ot6tyiAs1XszLU= =5FsU -----END PGP SIGNATURE----- --===-=-=--
--===============2121920907== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
--===============2121920907==--
|
|