arc.hpp 852 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. //
  3. // Copyright (c) 2019-2022 Ivan Baidakou (basiliscos) (the dot dmol at gmail dot com)
  4. //
  5. // Distributed under the MIT Software License
  6. //
  7. #include <boost/intrusive_ptr.hpp>
  8. #include <boost/smart_ptr/intrusive_ref_counter.hpp>
  9. #include "rotor/export.h"
  10. namespace rotor {
  11. #ifdef ROTOR_REFCOUNT_THREADUNSAFE
  12. /** \brief thread-unsafe intrusive pointer policy */
  13. using counter_policy_t = boost::thread_unsafe_counter;
  14. #else
  15. /** \brief thread-safe intrusive pointer policy */
  16. using counter_policy_t = boost::thread_safe_counter;
  17. #endif
  18. /** \brief base class to inject ref-counter with the specified policy */
  19. template <typename T> using arc_base_t = boost::intrusive_ref_counter<T, counter_policy_t>;
  20. /** \brief alias for intrusive pointer */
  21. template <typename T> using intrusive_ptr_t = boost::intrusive_ptr<T>;
  22. } // namespace rotor