arc.hpp 827 B

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. //
  3. // Copyright (c) 2019-2020 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. namespace rotor {
  10. #ifdef ROTOR_REFCOUNT_THREADUNSAFE
  11. /** \brief thread-unsafe intrusive pointer policy */
  12. using counter_policy_t = boost::thread_unsafe_counter;
  13. #else
  14. /** \brief thread-safe intrusive pointer policy */
  15. using counter_policy_t = boost::thread_safe_counter;
  16. #endif
  17. /** \brief base class to inject ref-counter with the specified policiy */
  18. template <typename T> using arc_base_t = boost::intrusive_ref_counter<T, counter_policy_t>;
  19. /** \brief alias for intrusive pointer */
  20. template <typename T> using intrusive_ptr_t = boost::intrusive_ptr<T>;
  21. } // namespace rotor