class CachedSize

Defined at line 166 of file ../../third_party/protobuf/src/google/protobuf/message_lite.h

Allow easy change to regular int on platforms where the atomic might have a

perf impact.

CachedSize is like std::atomic

<int

> but with some important changes:

1) CachedSize uses Get / Set rather than load / store.

2) CachedSize always uses relaxed ordering.

3) CachedSize is assignable and copy-constructible.

4) CachedSize has a constexpr default constructor, and a constexpr

constructor that takes an int argument.

5) If the compiler supports the __atomic_load_n / __atomic_store_n builtins,

then CachedSize is trivially copyable.

Developed at https://godbolt.org/z/vYcx7zYs1 ; supports gcc, clang, MSVC.

Public Methods

void CachedSize ()

Defined at line 171 of file ../../third_party/protobuf/src/google/protobuf/message_lite.h

void CachedSize (Scalar desired)

NOLINTNEXTLINE(google-explicit-constructor)

Defined at line 173 of file ../../third_party/protobuf/src/google/protobuf/message_lite.h

void CachedSize (const CachedSize & other)

Defined at line 176 of file ../../third_party/protobuf/src/google/protobuf/message_lite.h

Scalar Get ()

Defined at line 178 of file ../../third_party/protobuf/src/google/protobuf/message_lite.h

void Set (Scalar desired)

Defined at line 182 of file ../../third_party/protobuf/src/google/protobuf/message_lite.h

void SetNonZero (Scalar desired)

Defined at line 191 of file ../../third_party/protobuf/src/google/protobuf/message_lite.h