C++ Logo

std-discussion

Advanced search

Re: Should std::atomic<T*> have operator->?

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 22 Oct 2019 08:00:20 -0700
On Tuesday, 22 October 2019 00:14:52 PDT Andrey Semashev via Std-Discussion
wrote:
> > Sometimes it can
> >
> > void f()
> > {
> >
> > std::atomic_ptr<MyType> ptr = get_object();
> > ptr->do_one_thing();
> > ptr->do_another_thing();
> >
> > }
>
> In such pathologic cases I question whether atomic is needed in the
> first place.

You're probably right, but it's easy to see how it would happen if the atomic
is a member of a class.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products

Received on 2019-10-22 10:02:36