Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #6639

Re: instance counter

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 <pete@versatilecoding.com>
Organization Roundhouse Consulting, Ltd.
Newsgroups comp.lang.c++
Date Sat, 11 Jun 2011 14:01:53 -1000
Message-ID <2011061114015396183-pete@versatilecodingcom> (permalink)
References <ccf39133-e576-456d-9ee2-66f9bebdf8aa@d14g2000yqb.googlegroups.com> <ecSIp.1414$z%.403@newsfe12.iad> <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

Show key headers only | View raw


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<int> 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)

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

instance counter Moshbear dot Net <moshbear.net@gmail.com> - 2011-06-11 15:08 -0700
  Re: instance counter "Chris M. Thomasson" <cristom@charter.net> - 2011-06-11 15:43 -0700
    Re: instance counter Moshbear dot Net <moshbear.net@gmail.com> - 2011-06-11 15:58 -0700
      Re: instance counter Pete Becker <pete@versatilecoding.com> - 2011-06-11 14:01 -1000
        Re: instance counter "Chris M. Thomasson" <cristom@charter.net> - 2011-06-11 19:52 -0700
          Re: instance counter Moshbear dot Net <moshbear.net@gmail.com> - 2011-06-12 03:17 -0700
            Re: instance counter Paavo Helde <myfirstname@osa.pri.ee> - 2011-06-18 06:41 -0500

csiph-web