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


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

Re: instance counter

From Pete Becker <pete@versatilecoding.com>
Organization Roundhouse Consulting, Ltd.
Newsgroups comp.lang.c++
Date 2011-06-11 14:01 -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>
Subject Re: instance counter

Show all headers | 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