Skip to content

Commit 4805772

Browse files
committed
fix: atomic shared_ptr checks
1 parent be9a55a commit 4805772

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/mrdocs/Dom/Object.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,11 @@ class MRDOCS_DECL
432432
class MRDOCS_DECL
433433
LazyObjectImpl : public ObjectImpl
434434
{
435+
#ifdef __cpp_lib_atomic_shared_ptr
435436
std::atomic<std::shared_ptr<ObjectImpl>> mutable sp_;
437+
#else
438+
std::shared_ptr<ObjectImpl> mutable sp_;
439+
#endif
436440

437441
using impl_type = Object::impl_type;
438442

src/lib/Dom/Object.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ ObjectImpl&
217217
LazyObjectImpl::
218218
obj() const
219219
{
220+
#ifdef __cpp_lib_atomic_shared_ptr
220221
auto impl = sp_.load();
221222
if(impl)
222223
return *impl;
@@ -225,6 +226,9 @@ obj() const
225226
expected, construct().impl()))
226227
return *sp_.load();
227228
return *expected;
229+
#else
230+
return *sp_;
231+
#endif
228232
}
229233

230234
std::size_t

0 commit comments

Comments
 (0)