1 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED
2 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED
5 // boost/detail/atomic_count_std_atomic.hpp
7 // atomic_count for std::atomic
9 // Copyright 2013 Peter Dimov
11 // Distributed under the Boost Software License, Version 1.0.
12 // See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt
29 explicit atomic_count( long v ): value_( v )
35 return value_.fetch_add( 1, std::memory_order_acq_rel ) + 1;
40 return value_.fetch_sub( 1, std::memory_order_acq_rel ) - 1;
45 return value_.load( std::memory_order_acquire );
50 atomic_count(atomic_count const &);
51 atomic_count & operator=(atomic_count const &);
53 std::atomic_int_least32_t value_;
60 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED