MESSAGE
DATE | 2016-11-16 |
FROM | Ruben Safir
|
SUBJECT | Subject: [Learn] Fwd: Re: ref use
|
From learn-bounces-at-nylxs.com Wed Nov 16 23:52:42 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 49854161312; Wed, 16 Nov 2016 23:52:42 -0500 (EST) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by mrbrklyn.com (Postfix) with ESMTP id 59576160020 for ; Wed, 16 Nov 2016 23:52:38 -0500 (EST) Received: from [10.0.0.62] (www.mrbrklyn.com [96.57.23.82]) by mailbackend.panix.com (Postfix) with ESMTPSA id 6DB22132C3 for ; Wed, 16 Nov 2016 23:52:38 -0500 (EST) References: <8DBB6D36-D434-4EB9-BC1F-A4F26FD41DEE-at-liu.edu> To: learn-at-nylxs.com From: Ruben Safir X-Forwarded-Message-Id: <8DBB6D36-D434-4EB9-BC1F-A4F26FD41DEE-at-liu.edu> Message-ID: Date: Wed, 16 Nov 2016 23:52:37 -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: <8DBB6D36-D434-4EB9-BC1F-A4F26FD41DEE-at-liu.edu> Subject: [Learn] Fwd: Re: ref use 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="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
-------- Forwarded Message -------- Subject: Re: [Learn] ref use Date: Wed, 16 Nov 2016 12:14:00 +0000 From: Jose A. Rodriguez To: Ruben Safir
I'm not really up to date with the latest C++ stuff. But it seems to me you should be able to pass just a regular reference. From what I read reference wrappers are used mainly to store references in containers (e.g. vectors) that cannot normally hold references. > On Nov 16, 2016, at 5:40 AM, Ruben Safir wrote: > > any chance your up to date on this? I need a C++ mentor ;) > > Reuvain > > PS - I hope you are feeling well. > > > -------- Forwarded Message -------- > Subject: [Learn] ref use > Date: Wed, 16 Nov 2016 05:38:18 -0500 > From: Ruben Safir > To: learn-at-nylxs.com > > [This mail was also posted to comp.lang.c++.] > > I'm reading up on concurrency with the thread libraryis C++ Concurrency > in action by Anthony Williams and I'm puzzled by one example having to > do with sending references of objects through the threads. If you own > the text, it is one page 24 where he is callable functions is > void update_data_for_widget(widget_id w, widget_data& data); > > the call for the thread is > std::thread t (update_data_for_widget, w, data); where data is an > object, of data I suppose ;) > > to do this correctly he says we need to use ref and a reference wrapper > > std::thread t(update_data_for_widget, w, std::ref(data) ); > > Why can't you just send a reference? > > std::thread t(update_data_for_widget, w, &data ); > > > -- > 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 > >
_______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|