Sun Oct 25 04:01:20 2020
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2011-05-01

HANGOUT

2020-10-25 | 2020-09-25 | 2020-08-25 | 2020-07-25 | 2020-06-25 | 2020-05-25 | 2020-04-25 | 2020-03-25 | 2020-02-25 | 2020-01-25 | 2019-12-25 | 2019-11-25 | 2019-10-25 | 2019-09-25 | 2019-08-25 | 2019-07-25 | 2019-06-25 | 2019-05-25 | 2019-04-25 | 2019-03-25 | 2019-02-25 | 2019-01-25 | 2018-12-25 | 2018-11-25 | 2018-10-25 | 2018-09-25 | 2018-08-25 | 2018-07-25 | 2018-06-25 | 2018-05-25 | 2018-04-25 | 2018-03-25 | 2018-02-25 | 2018-01-25 | 2017-12-25 | 2017-11-25 | 2017-10-25 | 2017-09-25 | 2017-08-25 | 2017-07-25 | 2017-06-25 | 2017-05-25 | 2017-04-25 | 2017-03-25 | 2017-02-25 | 2017-01-25 | 2016-12-25 | 2016-11-25 | 2016-10-25 | 2016-09-25 | 2016-08-25 | 2016-07-25 | 2016-06-25 | 2016-05-25 | 2016-04-25 | 2016-03-25 | 2016-02-25 | 2016-01-25 | 2015-12-25 | 2015-11-25 | 2015-10-25 | 2015-09-25 | 2015-08-25 | 2015-07-25 | 2015-06-25 | 2015-05-25 | 2015-04-25 | 2015-03-25 | 2015-02-25 | 2015-01-25 | 2014-12-25 | 2014-11-25 | 2014-10-25 | 2014-09-25 | 2014-08-25 | 2014-07-25 | 2014-06-25 | 2014-05-25 | 2014-04-25 | 2014-03-25 | 2014-02-25 | 2014-01-25 | 2013-12-25 | 2013-11-25 | 2013-10-25 | 2013-09-25 | 2013-08-25 | 2013-07-25 | 2013-06-25 | 2013-05-25 | 2013-04-25 | 2013-03-25 | 2013-02-25 | 2013-01-25 | 2012-12-25 | 2012-11-25 | 2012-10-25 | 2012-09-25 | 2012-08-25 | 2012-07-25 | 2012-06-25 | 2012-05-25 | 2012-04-25 | 2012-03-25 | 2012-02-25 | 2012-01-25 | 2011-12-25 | 2011-11-25 | 2011-10-25 | 2011-09-25 | 2011-08-25 | 2011-07-25 | 2011-06-25 | 2011-05-25 | 2011-04-25 | 2011-03-25 | 2011-02-25 | 2011-01-25 | 2010-12-25 | 2010-11-25 | 2010-10-25 | 2010-09-25 | 2010-08-25 | 2010-07-25 | 2010-06-25 | 2010-05-25 | 2010-04-25 | 2010-03-25 | 2010-02-25 | 2010-01-25 | 2009-12-25 | 2009-11-25 | 2009-10-25 | 2009-09-25 | 2009-08-25 | 2009-07-25 | 2009-06-25 | 2009-05-25 | 2009-04-25 | 2009-03-25 | 2009-02-25 | 2009-01-25 | 2008-12-25 | 2008-11-25 | 2008-10-25 | 2008-09-25 | 2008-08-25 | 2008-07-25 | 2008-06-25 | 2008-05-25 | 2008-04-25 | 2008-03-25 | 2008-02-25 | 2008-01-25 | 2007-12-25 | 2007-11-25 | 2007-10-25 | 2007-09-25 | 2007-08-25 | 2007-07-25 | 2007-06-25 | 2007-05-25 | 2007-04-25 | 2007-03-25 | 2007-02-25 | 2007-01-25 | 2006-12-25 | 2006-11-25 | 2006-10-25 | 2006-09-25 | 2006-08-25 | 2006-07-25 | 2006-06-25 | 2006-05-25 | 2006-04-25 | 2006-03-25 | 2006-02-25 | 2006-01-25 | 2005-12-25 | 2005-11-25 | 2005-10-25 | 2005-09-25 | 2005-08-25 | 2005-07-25 | 2005-06-25 | 2005-05-25 | 2005-04-25 | 2005-03-25 | 2005-02-25 | 2005-01-25 | 2004-12-25 | 2004-11-25 | 2004-10-25 | 2004-09-25 | 2004-08-25 | 2004-07-25 | 2004-06-25 | 2004-05-25 | 2004-04-25 | 2004-03-25 | 2004-02-25 | 2004-01-25 | 2003-12-25 | 2003-11-25 | 2003-10-25 | 2003-09-25 | 2003-08-25 | 2003-07-25 | 2003-06-25 | 2003-05-25 | 2003-04-25 | 2003-03-25 | 2003-02-25 | 2003-01-25 | 2002-12-25 | 2002-11-25 | 2002-10-25 | 2002-09-25 | 2002-08-25 | 2002-07-25 | 2002-06-25 | 2002-05-25 | 2002-04-25 | 2002-03-25 | 2002-02-25 | 2002-01-25 | 2001-12-25 | 2001-11-25 | 2001-10-25 | 2001-09-25 | 2001-08-25 | 2001-07-25 | 2001-06-25 | 2001-05-25 | 2001-04-25 | 2001-03-25 | 2001-02-25 | 2001-01-25 | 2000-12-25 | 2000-11-25 | 2000-10-25 | 2000-09-25 | 2000-08-25 | 2000-07-25 | 2000-06-25 | 2000-05-25 | 2000-04-25 | 2000-03-25 | 2000-02-25 | 2000-01-25 | 1999-12-25

Key: Value:

Key: Value:

MESSAGE
DATE 2011-05-24
FROM Ruben Safir
SUBJECT Subject: [NYLXS - HANGOUT] [ruben@mrbrklyn.com: Re: [mrbrklyn@panix.com: Template Argument
From owner-hangout-outgoing-at-mrbrklyn.com Tue May 24 13:24:50 2011
Return-Path:
X-Original-To: archive-at-mrbrklyn.com
Delivered-To: archive-at-mrbrklyn.com
Received: by www2.mrbrklyn.com (Postfix)
id CFC5A100B19; Tue, 24 May 2011 13:24:49 -0400 (EDT)
Delivered-To: hangout-outgoing-at-www2.mrbrklyn.com
Received: by www2.mrbrklyn.com (Postfix, from userid 28)
id BEB4E100B1C; Tue, 24 May 2011 13:24:49 -0400 (EDT)
Delivered-To: hangout-at-nylxs.com
Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89])
by www2.mrbrklyn.com (Postfix) with ESMTP id 65A2B100B19
for ; Tue, 24 May 2011 13:24:49 -0400 (EDT)
Received: from panix5.panix.com (panix5.panix.com [166.84.1.5])
by mailbackend.panix.com (Postfix) with ESMTP id 15BFC32CD7
for ; Tue, 24 May 2011 13:25:11 -0400 (EDT)
Received: by panix5.panix.com (Postfix, from userid 20529)
id 021142424F; Tue, 24 May 2011 13:25:10 -0400 (EDT)
Date: Tue, 24 May 2011 13:25:10 -0400
From: Ruben Safir
To: hangout-at-nylxs.com
Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: [mrbrklyn-at-panix.com: Template Argument
type deterination]]
Message-ID: <20110524172510.GB21131-at-panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-06-14)
Sender: owner-hangout-at-mrbrklyn.com
Precedence: bulk
Reply-To: hangout-at-mrbrklyn.com

----- Forwarded message from Ruben Safir -----

Date: Tue, 24 May 2011 12:40:26 -0400
From: Ruben Safir
To: Billy
Cc: Ruben Safir
Subject: Re: [mrbrklyn-at-panix.com: Template Argument type deterination]
User-Agent: Mutt/1.5.20 (2009-06-14)

On Tue, May 24, 2011 at 12:25:09PM -0400, Billy Donahue wrote:
> You didn't provide the constructor of stats::Distribution. If a constructor
> takes a single argument, it will be considered a conversion operator unless
> it is marked 'explicit'. Most style guides including Google's urge
> programmers to mark any single argument constructor as 'explicit', which
> make it ineligible as a conversion operator.
>
> Another thing is that maybe an integer is being used as a pointer or
> something.
> I can't really tell exactly through the levels of indirection.
>
> I'm uneasy because I don't see a single-arg constructor in the 'gdb' ptype
> output.
> But that isn't source code, that's gdb output. Only source code matters.
> The constructor might have been inlined and optimized away, for example.
>
> On Mon, May 23, 2011 at 4:50 PM, Ruben Safir wrote:
>


Ah - thank you for answering. It's driving me crazy and I'm not finding
help in texts or on the net.

So now I have a new concept, a conversion operator. What is a
conversion operator.

I tried to make this a simpler example, but it is really just related,
perhaps not exactly the same.


testm(intval) fails to compile in the below example, as I'd expect since
the param type is stats::Distribution and not an int. But
testme(intval) does compile with the same kind of promotion

http://www.nylxs.com/docs/workshops/test_del3.cpp.html

http://www.nylxs.com/docs/workshops/test_del3.tgz

There is a difference in this example though because the original
behavior was demonstated not by a templated function, but a member of a
templated class.

And I agree the indirection starts to make it very difficult to figure
out or predict that typename T is being sunstituted for as the template
class stacks get deeper.

Ruben
> > ----- Forwarded message from Ruben Safir -----
> >
> > Date: Mon, 23 May 2011 16:35:54 -0400
> > From: Ruben Safir
> > To: hangout-at-nylxs.com
> > Subject: Template Argument type deterination
> > User-Agent: Mutt/1.5.20 (2009-06-14)
> >
> >
> > I'm having trouble understanding why my program is making a change in
> > the
> > argument type of my template class function
> >
> > template < class T >
> > void List::find_value(T val)
> > {
> > cursor() = front();
> > while(cursor() != endd()){
> > if (*(cursor()->value()) == val)
> > return;
> > else{
> > cursor(cursor()->next());
> > }
> > }
> > if(*(endd()->value()) == val)
> > return;
> > else{
> > cursor() = 0; //park the cursor when nothing is found
> > }
> > }
> >
> >
> > It's part of a List template class
> >
> > I call it from a templated fucntion in a different namespace as follows:
> >
> >
> > tally = new chainlist::List >;
> > tallies = new chainlist::List< chainlist::List< stats::Distribution
> > > *>;
> >
> > std::cout << "The standard mean for picking 7 is ==> " <<
> > stats::mean_list(tallies, 7 ) << std::endl;;
> >
> > template
> > float mean_list(chainlist::List<
> > chainlist::List >* > * tallies, T search_val){
> > if(tallies->endd() == 0){
> > std::cout << "Empty List" << std::endl;
> > return 0.0;
> > }
> > int sum = 0;
> > chainlist::List > * dump;
> > tallies->cursor() = tallies->front();
> > while(tallies->cursor() != tallies->endd() ){
> > //tallies->cursor()->value()->find_value(search_val);
> > dump = *(tallies->cursor()->value());
> > //dump->cursor() = dump->endd();
> > //std::cout << "Testing\n" <<
> > //*(dump->cursor()->value()) << std::endl;
> > dump->find_value(search_val);
> > if(dump->cursor() != NULL)
> > sum += dump->cursor()->value()->population();
> > tallies->cursor(tallies->cursor()->next());
> > }
> > dump = *(tallies->cursor()->value());
> > dump->find_value(search_val);
> > if(dump->cursor() != 0)
> > sum += dump->cursor()->value()->population();
> > float tot = (float) sum/(float)(tallies->size());
> > std::cout << "Mean " << tot << " sum " << sum << " size " <<
> > tallies->size() << std::endl;
> > return tot;
> >
> > }
> >
> > Now T is an integer for mean_list, and the first argument is of type
> >
> > chainlist::List< chainlist::List >* > * when
> > called and the second argument is of type int
> >
> > I then pass int search_val to method chainlist::List::find_value(T)
> > where T = stats::Distribution (where T is an int)
> > on this line:
> >
> > dump->find_value(search_val);
> >
> > and that's where the weirdness happens. I have a type mismatch since
> > I'm sending by value an integer instead of a stats::Distribution
> >
> > Instead the program calls the stat::Distribution constructor using 7,
> > the value of search_val, as an argument redrawing search_val as type
> > to a Distribution
> >
> > :in gdb
> >
> >
> > 312 void List::find_value(T val)
> > 313 {
> > 314 cursor() = front();
> > 315 while(cursor() != endd()){
> > 316 if (*(cursor()->value()) == val)
> > 317 return;
> > 318 else{
> > 319 cursor(cursor()->next());
> > 320 }
> > 321 }
> > 322 if(*(endd()->value()) == val)
> > 323 return;
> > 324 else{
> > 325 cursor() = 0; //park the cursor when nothing is found
> > 326 }
> > 327 }
> >
> > chainlist::List >::find_value (this=0x804f008,
> > val=...) at linklist.h:314
> > (gdb) ptype val
> > type = class stats::Distribution {
> > public:
> > chainlist::List > *tally;
> > private:
> > int freq;
> > int occurances;
> >
> > public:
> > void Distribution(int, int);
> > void Distribution(void);
> > int description(void) const;
> > int population(void) const;
> > void increase_occ(void);
> > void descrease_occ(void);
> > int operator()(void);
> > bool operator==(stats::Distribution &);
> > bool operator<(stats::Distribution &);
> > float stddev(chainlist::List > *);
> > }
> >
> >
> > What rule for Template argument matching allows for this kind of magic?
> >
> >
> > ----- End forwarded message -----
> >
> > --
> > http://www.mrbrklyn.com - Interesting Stuff
> > http://www.nylxs.com - Leadership Development in Free Software
> >
> > 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://fairuse.nylxs.com DRM is THEFT - We are the STAKEHOLDERS - RI
> > Safir 2002
> >
> > "Yeah - I write Free Software...so SUE ME"
> >
> > "The tremendous problem we face is that we are becoming sharecroppers to
> > our own cultural heritage -- we need the ability to participate in our own
> > society."
> >
> > "> I'm an engineer. I choose the best tool for the job, politics be
> > damned.<
> > You must be a stupid engineer then, because politcs and technology have
> > been attached at the hip since the 1st dynasty in Ancient Egypt. I guess
> > you missed that one."
> >
> > ? Copyright for the Digital Millennium
> >
>
>
>
> --
> ?n??uop ?ll?q

--
http://www.mrbrklyn.com - Interesting Stuff
http://www.nylxs.com - Leadership Development in Free Software

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://fairuse.nylxs.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

"Yeah - I write Free Software...so SUE ME"

"The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."

"> I'm an engineer. I choose the best tool for the job, politics be damned.<
You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt. I guess you missed that one."

? Copyright for the Digital Millennium

----- End forwarded message -----

  1. 2011-05-02 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  2. 2011-05-06 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] NYLXS Business
  3. 2011-05-06 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] NYLXS Business
  4. 2011-05-06 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] NYLXS Business
  5. 2011-05-09 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] UPDATED! NYLUG Presents: 5/18 -at- 6:30PM Cameron L. Fadjo on Construct, Program, Design: An Introduction to Scratch From the Perspective of Computing and Cognition
  6. 2011-05-09 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  7. 2011-05-10 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday May 10 6:00PM-8:00PM
  8. 2011-05-15 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  9. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - Notes
  10. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: [New-York-C-Developers-Group] MongoNYC - MongoDB Conference
  11. 2011-05-16 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  12. 2011-05-18 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [rick-at-linuxmafia.com: [conspire] YouTube downloading software
  13. 2011-05-19 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - creating a distribution list
  14. 2011-05-19 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - creating a distribution list
  15. 2011-05-20 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  16. 2011-05-22 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  17. 2011-05-22 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  18. 2011-05-23 swd <sderrick-at-optonline.net> Subject: [NYLXS - HANGOUT] Membership Dues Address?
  19. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  20. 2011-05-23 swd <sderrick-at-optonline.net> RE: [NYLXS - HANGOUT] Membership Dues Address?
  21. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Template Argument type deterination
  22. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  23. 2011-05-23 swd <sderrick-at-optonline.net> RE: [NYLXS - HANGOUT] Membership Dues Address?
  24. 2011-05-23 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Membership Dues Address?
  25. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ian.bruntlett-at-gmail.com: [accu-general] Free e-book:- The
  26. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Job Fair
  27. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [billy.donahue-at-gmail.com: Re: [mrbrklyn-at-panix.com: Template
  28. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: [mrbrklyn-at-panix.com: Template Argument
  29. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: [mrbrklyn-at-panix.com: Template Argument
  30. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  31. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  32. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re:
  33. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] template implicit converstion
  34. 2011-05-24 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday May 24 6:00PM-8:00PM
  35. 2011-05-24 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [mrbrklyn-at-panix.com: (fwd) Template argument determination]
  36. 2011-05-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  37. 2011-05-25 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] C++ Workshop - New Webservices with OKWS -
  38. 2011-05-26 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Presents: 6/15 -at- 6:30PM Robert Menes on Rockbox: Open Source Jukebox Firmware
  39. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  40. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  41. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [ruben-at-mrbrklyn.com: Re: [NYLXS - HANGOUT] C++ Workshop - New
  42. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Perl Class
  43. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Perl Class
  44. 2011-05-26 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Postgres Class
  45. 2011-05-26 Paul Robert Marino <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] Postgres Class
  46. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop - next phase
  47. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: Consensus from last night's meeting
  48. 2011-05-27 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Fwd: Re: [The-New-York-Perl-Meetup-Group] Consensus from last night's
  49. 2011-05-30 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Job opennings
  50. 2011-05-31 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] C++ Workshop

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!