allocator_traits.hpp 1.2 KB

123456789101112131415161718192021222324252627282930
  1. //
  2. // Copyright (c) 2024 Alexander Grund
  3. //
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // https://www.boost.org/LICENSE_1_0.txt
  6. #ifndef BOOST_LOCALE_DETAIL_ALLOCATOR_TRAITS_HPP_INCLUDED
  7. #define BOOST_LOCALE_DETAIL_ALLOCATOR_TRAITS_HPP_INCLUDED
  8. #include <boost/locale/config.hpp>
  9. #include <memory>
  10. #include <type_traits>
  11. /// \cond INTERNAL
  12. namespace boost { namespace locale { namespace conv { namespace detail {
  13. template<class Alloc, typename T>
  14. using rebind_alloc = typename std::allocator_traits<Alloc>::template rebind_alloc<T>;
  15. template<class Alloc, typename T, typename Result = void>
  16. using enable_if_allocator_for =
  17. typename std::enable_if<std::is_same<typename Alloc::value_type, T>::value, Result>::type;
  18. template<class Alloc, typename T, class Alloc2, typename T2, typename Result = void>
  19. using enable_if_allocator_for2 = typename std::enable_if<std::is_same<typename Alloc::value_type, T>::value
  20. && std::is_same<typename Alloc2::value_type, T2>::value,
  21. Result>::type;
  22. }}}} // namespace boost::locale::conv::detail
  23. /// \endcond
  24. #endif