• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//  (C) Copyright John Maddock 2012
2
3//  Use, modification and distribution are subject to the
4//  Boost Software License, Version 1.0. (See accompanying file
5//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7//  See http://www.boost.org/libs/config for more information.
8
9//  MACRO:         BOOST_NO_CXX11_ATOMIC_SMART_PTR
10//  TITLE:         C++11 <memory> does not support atomic smart pointer operations
11//  DESCRIPTION:   The compiler does not support the C++11 atomic smart pointer features added to <memory>
12
13#include <memory>
14
15namespace boost_no_cxx11_atomic_smart_ptr {
16
17int test()
18{
19   std::shared_ptr<int> spi(new int), spi2(new int);
20   spi = std::static_pointer_cast<int>(spi);
21
22   atomic_is_lock_free(&spi);
23   atomic_load(&spi);
24   atomic_load_explicit(&spi, std::memory_order_relaxed);
25   atomic_store(&spi, spi2);
26   atomic_store_explicit(&spi, spi2, std::memory_order_relaxed);
27   atomic_exchange(&spi, spi2);
28   atomic_compare_exchange_weak(&spi, &spi2, spi);
29   atomic_compare_exchange_strong(&spi, &spi2, spi);
30   atomic_compare_exchange_weak_explicit(&spi, &spi2, spi, std::memory_order_relaxed, std::memory_order_relaxed);
31   atomic_compare_exchange_strong_explicit(&spi, &spi2, spi, std::memory_order_relaxed, std::memory_order_relaxed);
32
33   return 0;
34}
35
36}
37