Add alias templates for associators.

This commit is contained in:
Christopher Kohlhoff 2017-07-15 19:10:30 +10:00
parent e502a6b364
commit 64ae9bcaee
3 changed files with 33 additions and 0 deletions

View File

@ -116,6 +116,14 @@ get_associated_allocator(const T& t, const Allocator& a) ASIO_NOEXCEPT
return associated_allocator<T, Allocator>::get(t, a);
}
#if defined(ASIO_HAS_ALIAS_TEMPLATES)
template <typename T, typename Allocator = std::allocator<void> >
using associated_allocator_t
= typename associated_allocator<T, Allocator>::type;
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
} // namespace asio
#include "asio/detail/pop_options.hpp"

View File

@ -135,6 +135,13 @@ get_associated_executor(const T& t, ExecutionContext& ctx,
typename ExecutionContext::executor_type>::get(t, ctx.get_executor());
}
#if defined(ASIO_HAS_ALIAS_TEMPLATES)
template <typename T, typename Executor = system_executor>
using associated_executor_t = typename associated_executor<T, Executor>::type;
#endif // defined(ASIO_HAS_ALIAS_TEMPLATES)
} // namespace asio
#include "asio/detail/pop_options.hpp"

View File

@ -264,6 +264,24 @@
# endif // !defined(ASIO_DISABLE_DECLTYPE)
#endif // !defined(ASIO_HAS_DECLTYPE)
// Support alias templates on compilers known to allow it.
#if !defined(ASIO_HAS_ALIAS_TEMPLATES)
# if !defined(ASIO_DISABLE_ALIAS_TEMPLATES)
# if defined(__clang__)
# if __has_feature(__cxx_alias_templates__)
# define ASIO_HAS_ALIAS_TEMPLATES 1
# endif // __has_feature(__cxx_alias_templates__)
# endif // defined(__clang__)
# if defined(__GNUC__)
# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
# if defined(__GXX_EXPERIMENTAL_CXX0X__)
# define ASIO_HAS_ALIAS_TEMPLATES 1
# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
# endif // defined(__GNUC__)
# endif // !defined(ASIO_DISABLE_ALIAS_TEMPLATES)
#endif // !defined(ASIO_HAS_ALIAS_TEMPLATES)
// Standard library support for system errors.
#if !defined(ASIO_HAS_STD_SYSTEM_ERROR)
# if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)