placeholders.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // placeholders.hpp
  3. // ~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2023 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_PLACEHOLDERS_HPP
  11. #define ASIO_PLACEHOLDERS_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/functional.hpp"
  17. #include "asio/detail/push_options.hpp"
  18. namespace asio {
  19. namespace placeholders {
  20. #if defined(GENERATING_DOCUMENTATION)
  21. /// An argument placeholder, for use with std::bind() or boost::bind(), that
  22. /// corresponds to the error argument of a handler for any of the asynchronous
  23. /// functions.
  24. unspecified error;
  25. /// An argument placeholder, for use with std::bind() or boost::bind(), that
  26. /// corresponds to the bytes_transferred argument of a handler for asynchronous
  27. /// functions such as asio::basic_stream_socket::async_write_some or
  28. /// asio::async_write.
  29. unspecified bytes_transferred;
  30. /// An argument placeholder, for use with std::bind() or boost::bind(), that
  31. /// corresponds to the iterator argument of a handler for asynchronous functions
  32. /// such as asio::async_connect.
  33. unspecified iterator;
  34. /// An argument placeholder, for use with std::bind() or boost::bind(), that
  35. /// corresponds to the results argument of a handler for asynchronous functions
  36. /// such as asio::basic_resolver::async_resolve.
  37. unspecified results;
  38. /// An argument placeholder, for use with std::bind() or boost::bind(), that
  39. /// corresponds to the results argument of a handler for asynchronous functions
  40. /// such as asio::async_connect.
  41. unspecified endpoint;
  42. /// An argument placeholder, for use with std::bind() or boost::bind(), that
  43. /// corresponds to the signal_number argument of a handler for asynchronous
  44. /// functions such as asio::signal_set::async_wait.
  45. unspecified signal_number;
  46. #else
  47. static constexpr auto& error = std::placeholders::_1;
  48. static constexpr auto& bytes_transferred = std::placeholders::_2;
  49. static constexpr auto& iterator = std::placeholders::_2;
  50. static constexpr auto& results = std::placeholders::_2;
  51. static constexpr auto& endpoint = std::placeholders::_2;
  52. static constexpr auto& signal_number = std::placeholders::_2;
  53. #endif
  54. } // namespace placeholders
  55. } // namespace asio
  56. #include "asio/detail/pop_options.hpp"
  57. #endif // ASIO_PLACEHOLDERS_HPP