Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

unsafe_refcount_policy.hpp
Go to the documentation of this file.
1 //
2 // immer: immutable data structures for C++
3 // Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente
4 //
5 // This software is distributed under the Boost Software License, Version 1.0.
6 // See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
7 //
8 
9 #pragma once
10 
12 
13 #include <atomic>
14 #include <utility>
15 
16 namespace immer {
17 
23 {
25 
26  mutable int refcount;
27 
30 
31  void inc() { ++refcount; }
32  bool dec() { return --refcount == 0; }
33  void dec_unsafe() { --refcount; }
34  bool unique() { return refcount == 1; }
35 };
36 
37 } // namespace immer
Released under the MIT license