Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

handler_invoke_helpers.hpp 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // detail/handler_invoke_helpers.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP
  11. #define ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include "asio/detail/memory.hpp"
  17. #include "asio/handler_invoke_hook.hpp"
  18. #include "asio/detail/push_options.hpp"
  19. // Calls to asio_handler_invoke must be made from a namespace that does not
  20. // contain overloads of this function. The asio_handler_invoke_helpers
  21. // namespace is defined here for that purpose.
  22. namespace asio_handler_invoke_helpers {
  23. template <typename Function, typename Context>
  24. inline void invoke(Function& function, Context& context)
  25. {
  26. #if !defined(ASIO_HAS_HANDLER_HOOKS)
  27. Function tmp(function);
  28. tmp();
  29. #else
  30. using asio::asio_handler_invoke;
  31. asio_handler_invoke(function, asio::detail::addressof(context));
  32. #endif
  33. }
  34. template <typename Function, typename Context>
  35. inline void invoke(const Function& function, Context& context)
  36. {
  37. #if !defined(ASIO_HAS_HANDLER_HOOKS)
  38. Function tmp(function);
  39. tmp();
  40. #else
  41. using asio::asio_handler_invoke;
  42. asio_handler_invoke(function, asio::detail::addressof(context));
  43. #endif
  44. }
  45. } // namespace asio_handler_invoke_helpers
  46. #include "asio/detail/pop_options.hpp"
  47. #endif // ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP