HelenOS sources
#ifndef LIBCPP_BITS_MEMORY_TYPE_GETTERS
#define LIBCPP_BITS_MEMORY_TYPE_GETTERS
#include <__bits/aux.hpp>
#include <cstddef>
#include <type_traits>
namespace std
{
template<class T>
struct pointer_traits;
}
namespace std::aux
{
template<class Ptr, class = void>
struct ptr_get_element_type
{ };
template<class Ptr>
struct ptr_get_element_type<Ptr, void_t<typename Ptr::element_type>>
: aux::type_is<typename Ptr::element_type>
{ };
template<template <class, class...> class Ptr, class T, class... Args>
struct ptr_get_element_type<
Ptr<T, Args...>, void_t<typename Ptr<T, Args...>::element_type>
>: aux::type_is<typename Ptr<T, Args...>::element_type>
{ };
template<class Ptr, class = void>
struct ptr_get_difference_type: aux::type_is<ptrdiff_t>
{ };
template<class Ptr>
struct ptr_get_difference_type<Ptr, void_t<typename Ptr::difference_type>>
: aux::type_is<typename Ptr::difference_type>
{ };
template<class Ptr, class U, class = void>
struct ptr_get_rebind
{ };
template<class Ptr, class U>
struct ptr_get_rebind<Ptr, U, void_t<typename Ptr::template rebind<U>>>
: aux::type_is<typename Ptr::template rebind<U>>
{ };
template<template <class, class...> class Ptr, class T, class... Args, class U>
struct ptr_get_rebind<Ptr<T, Args...>, U>
: aux::type_is<Ptr<U, Args...>>
{ };
template<class T, class = void>
struct alloc_get_pointer: aux::type_is<typename T::value_type*>
{ };
template<class T>
struct alloc_get_pointer<T, void_t<typename T::pointer>>
: aux::type_is<typename T::pointer>
{ };
template<class T, class Ptr, class = void>
struct alloc_get_const_pointer
: aux::type_is<typename pointer_traits<Ptr>::template rebind<const typename T::value_type>>
{ };
template<class T, class Ptr>
struct alloc_get_const_pointer<T, Ptr, void_t<typename T::const_pointer>>
: aux::type_is<typename T::const_pointer>
{ };
template<class T, class Ptr, class = void>
struct alloc_get_void_pointer
: aux::type_is<typename pointer_traits<Ptr>::template rebind<void>>
{ };
template<class T, class Ptr>
struct alloc_get_void_pointer<T, Ptr, void_t<typename T::void_pointer>>
: aux::type_is<typename T::void_pointer>
{ };
template<class T, class Ptr, class = void>
struct alloc_get_const_void_pointer
: aux::type_is<typename pointer_traits<Ptr>::template rebind<const void>>
{ };
template<class T, class Ptr>
struct alloc_get_const_void_pointer<T, Ptr, void_t<typename T::const_void_pointer>>
: aux::type_is<typename T::const_void_pointer>
{ };
template<class T, class Ptr, class = void>
struct alloc_get_difference_type
: aux::type_is<typename pointer_traits<Ptr>::difference_type>
{ };
template<class T, class Ptr>
struct alloc_get_difference_type<T, Ptr, void_t<typename T::difference_type>>
: aux::type_is<typename T::difference_type>
{ };
template<class T, class Difference, class = void>
struct alloc_get_size_type: aux::type_is<make_unsigned_t<Difference>>
{ };
template<class T, class Difference>
struct alloc_get_size_type<T, Difference, void_t<typename T::size_type>>
: aux::type_is<typename T::size_type>
{ };
template<class T, class = void>
struct alloc_get_copy_propagate: aux::type_is<false_type>
{ };
template<class T>
struct alloc_get_copy_propagate<T, void_t<typename T::propagate_on_container_copy_assignment>>
: aux::type_is<typename T::propagate_on_container_copy_assignment>
{ };
template<class T, class = void>
struct alloc_get_move_propagate: aux::type_is<false_type>
{ };
template<class T>
struct alloc_get_move_propagate<T, void_t<typename T::propagate_on_container_move_assignment>>
: aux::type_is<typename T::propagate_on_container_move_assignment>
{ };
template<class T, class = void>
struct alloc_get_swap_propagate: aux::type_is<false_type>
{ };
template<class T>
struct alloc_get_swap_propagate<T, void_t<typename T::propagate_on_container_swap>>
: aux::type_is<typename T::propagate_on_container_swap>
{ };
template<class T, class = void>
struct alloc_get_always_equal: aux::type_is<typename is_empty<T>::type>
{ };
template<class T>
struct alloc_get_always_equal<T, void_t<typename T::is_always_equal>>
: aux::type_is<typename T::is_always_equal>
{ };
template<class Alloc, class T, class = void>
struct alloc_get_rebind_alloc
{ };
template<class Alloc, class T>
struct alloc_get_rebind_alloc<Alloc, T, void_t<typename Alloc::template rebind<T>::other>>
: aux::type_is<typename Alloc::template rebind<T>::other>
{ };
template<template <class, class...> class Alloc, class U, class... Args, class T>
struct alloc_get_rebind_alloc<Alloc<U, Args...>, T>
: aux::type_is<Alloc<T, Args...>>
{ };
template<class Alloc, class Size, class ConstVoidPointer, class = void>
struct alloc_has_hint_allocate: false_type
{ };
template<class Alloc, class Size, class ConstVoidPointer>
struct alloc_has_hint_allocate<
Alloc, Size, ConstVoidPointer, void_t<
decltype(declval<Alloc>().alloc(declval<Size>(), declval<ConstVoidPointer>()))
>
>: true_type
{ };
template<class, class Alloc, class T, class... Args>
struct alloc_has_construct_impl: false_type
{ };
template<class Alloc, class T, class... Args>
struct alloc_has_construct_impl<
void_t<decltype(declval<Alloc>().construct(declval<T*>(), forward<Args>(declval<Args>())...))>,
Alloc, T, Args...
>: true_type
{ };
template<class Alloc, class T, class = void>
struct alloc_has_destroy: false_type
{ };
template<class Alloc, class T>
struct alloc_has_destroy<Alloc, T, void_t<decltype(declval<Alloc>().destroy(declval<T>()))>>
: true_type
{ };
template<class Alloc, class T, class... Args>
struct alloc_has_construct
: alloc_has_construct_impl<void_t<>, Alloc, T, Args...>
{ };
template<class Alloc, class = void>
struct alloc_has_max_size: false_type
{ };
template<class Alloc>
struct alloc_has_max_size<Alloc, void_t<decltype(declval<Alloc>().max_size())>>
: true_type
{ };
template<class Alloc, class = void>
struct alloc_has_select: false_type
{ };
template<class Alloc>
struct alloc_has_select<
Alloc, void_t<
decltype(declval<Alloc>().select_on_container_copy_construction())
>
>: true_type
{ };
}
#endif
HelenOS homepage, sources at GitHub