Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 11 Jun 2011 19:01:53 -0500 From: Pete Becker Organization: Roundhouse Consulting, Ltd. Newsgroups: comp.lang.c++ Date: Sat, 11 Jun 2011 14:01:53 -1000 Message-ID: <2011061114015396183-pete@versatilecodingcom> References: <80324efc-d3cb-44c9-be7e-837ead801ec6@m4g2000yqk.googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: instance counter User-Agent: Unison/2.1.4 Lines: 24 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-Wjlcmx5WJ1gCUZEfbRo/P2rbHcFD25QbhCxMCtfi8//87ee88kIugM/VhghvV4BxCrb0dJ9x5zK3lLm!Iq930FWmmVcSPR5E2X7CHt0yf5dbHOkCZ418otLdW55lOJNEaZ3BgNAvWQGqIHAng323IKo= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1630 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:6639 On 2011-06-11 12:58:12 -1000, Moshbear dot Net said: > > Is there a portable way of doing > atomic { > ++xctr; > ctr = xctr; > } > std::atomic xctr = 0; and ctr = ++xctr; That's with C++11; your library might already have it. -- Pete Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The Standard C++ Library Extensions: a Tutorial and Reference (www.petebecker.com/tr1book)