Debian Codegraph @

libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // UNSUPPORTED: no-threads
10
11 // <memory>
12
13 // shared_ptr
14
15 // template <class T>
16 // shared_ptr<T>
17 // atomic_load_explicit(const shared_ptr<T>* p, memory_order mo)
18
19 // UNSUPPORTED: c++03
20
21 #include <memory>
22
23 #include <atomic>
24 #include <cassert>
25
26 #include "test_macros.h"
27
28 int main(int, char**)
29 {
30 {
31 const std::shared_ptr<int> p(new int(3));
32 std::shared_ptr<int> q = std::atomic_load_explicit(&p, std::memory_order_relaxed);
33 assert(*q == *p);
34 }
35
36 return 0;
37 }