Home | History | Annotate | Download | only in util.smartptr.shared.atomic
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <memory>
     11 
     12 // shared_ptr
     13 
     14 // template <class T>
     15 // shared_ptr<T>
     16 // atomic_load_explicit(const shared_ptr<T>* p, memory_order mo)
     17 
     18 #include <memory>
     19 #include <cassert>
     20 
     21 int main()
     22 {
     23 #if __has_feature(cxx_atomic)
     24     {
     25         const std::shared_ptr<int> p(new int(3));
     26         std::shared_ptr<int> q = std::atomic_load_explicit(&p, std::memory_order_relaxed);
     27         assert(*q == *p);
     28     }
     29 #endif
     30 }
     31