placeholders.hpp 2.6 KB

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