/Src/Dependencies/Boost/boost/asio/placeholders.hpp

http://hadesmem.googlecode.com/ · C++ Header · 122 lines · 75 code · 26 blank · 21 comment · 2 complexity · 2d3ba588469d1835b556f901609b9b0a MD5 · raw file

  1. //
  2. // placeholders.hpp
  3. // ~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2011 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/bind/arg.hpp>
  17. #include <boost/detail/workaround.hpp>
  18. #include <boost/asio/detail/push_options.hpp>
  19. namespace boost {
  20. namespace asio {
  21. namespace placeholders {
  22. #if defined(GENERATING_DOCUMENTATION)
  23. /// An argument placeholder, for use with boost::bind(), that corresponds to
  24. /// the error argument of a handler for any of the asynchronous functions.
  25. unspecified error;
  26. /// An argument placeholder, for use with boost::bind(), that corresponds to
  27. /// the bytes_transferred argument of a handler for asynchronous functions such
  28. /// 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 boost::bind(), that corresponds to
  32. /// the iterator argument of a handler for asynchronous functions such as
  33. /// boost::asio::basic_resolver::async_resolve.
  34. unspecified iterator;
  35. /// An argument placeholder, for use with boost::bind(), that corresponds to
  36. /// the signal_number argument of a handler for asynchronous functions such as
  37. /// boost::asio::signal_set::async_wait.
  38. unspecified signal_number;
  39. #elif defined(__BORLANDC__) || defined(__GNUC__)
  40. inline boost::arg<1> error()
  41. {
  42. return boost::arg<1>();
  43. }
  44. inline boost::arg<2> bytes_transferred()
  45. {
  46. return boost::arg<2>();
  47. }
  48. inline boost::arg<2> iterator()
  49. {
  50. return boost::arg<2>();
  51. }
  52. inline boost::arg<2> signal_number()
  53. {
  54. return boost::arg<2>();
  55. }
  56. #else
  57. namespace detail
  58. {
  59. template <int Number>
  60. struct placeholder
  61. {
  62. static boost::arg<Number>& get()
  63. {
  64. static boost::arg<Number> result;
  65. return result;
  66. }
  67. };
  68. }
  69. #if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
  70. static boost::arg<1>& error
  71. = boost::asio::placeholders::detail::placeholder<1>::get();
  72. static boost::arg<2>& bytes_transferred
  73. = boost::asio::placeholders::detail::placeholder<2>::get();
  74. static boost::arg<2>& iterator
  75. = boost::asio::placeholders::detail::placeholder<2>::get();
  76. static boost::arg<2>& signal_number
  77. = boost::asio::placeholders::detail::placeholder<2>::get();
  78. #else
  79. namespace
  80. {
  81. boost::arg<1>& error
  82. = boost::asio::placeholders::detail::placeholder<1>::get();
  83. boost::arg<2>& bytes_transferred
  84. = boost::asio::placeholders::detail::placeholder<2>::get();
  85. boost::arg<2>& iterator
  86. = boost::asio::placeholders::detail::placeholder<2>::get();
  87. boost::arg<2>& signal_number
  88. = boost::asio::placeholders::detail::placeholder<2>::get();
  89. } // namespace
  90. #endif
  91. #endif
  92. } // namespace placeholders
  93. } // namespace asio
  94. } // namespace boost
  95. #include <boost/asio/detail/pop_options.hpp>
  96. #endif // BOOST_ASIO_PLACEHOLDERS_HPP