Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions include/asio/placeholders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@ unspecified signal_number;

#else

#if _LIBCPP_STD_VER >= 17
// C++17 recommends that we implement placeholders as `inline constexpr`, but allows
// implementing them as `extern <implementation-defined>`. Libc++ implements them as
// `extern const` in all standard modes to avoid an ABI break in C++03: making them
// `inline constexpr` requires removing their definition in the shared library to
// avoid ODR violations, which is an ABI break.
static ASIO_INLINE_VARIABLE const auto& error
= std::placeholders::_1;
static ASIO_INLINE_VARIABLE const auto& bytes_transferred
= std::placeholders::_2;
static ASIO_INLINE_VARIABLE const auto& iterator
= std::placeholders::_2;
static ASIO_INLINE_VARIABLE const auto& results
= std::placeholders::_2;
static ASIO_INLINE_VARIABLE const auto& endpoint
= std::placeholders::_2;
static ASIO_INLINE_VARIABLE const auto& signal_number
= std::placeholders::_2;
#else
static ASIO_INLINE_VARIABLE constexpr auto& error
= std::placeholders::_1;
static ASIO_INLINE_VARIABLE constexpr auto& bytes_transferred
Expand All @@ -71,6 +90,7 @@ static ASIO_INLINE_VARIABLE constexpr auto& endpoint
= std::placeholders::_2;
static ASIO_INLINE_VARIABLE constexpr auto& signal_number
= std::placeholders::_2;
#endif

#endif

Expand Down