make_unsigned.qbk 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. [/
  2. Copyright 2007 John Maddock.
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ]
  7. [section:make_unsigned make_unsigned]
  8. template <class T>
  9. struct make_unsigned
  10. {
  11. typedef __below type;
  12. };
  13. template <class T> using make_unsigned_t = typename make_unsigned<T>::type; // C++11 and above
  14. __type If T is a unsigned integer type then the same type as T, if T is an
  15. signed integer type then the corresponding unsigned type.
  16. Otherwise if T is an enumerated or
  17. character type (char or wchar_t) then an unsigned integer type with the same
  18. width as T.
  19. If T has any cv-qualifiers then these are also present on the result type.
  20. [*Requires:] T must be an integer or enumerated type, and must not be the type
  21. bool.
  22. __std_ref 3.9.1.
  23. [all_compilers]
  24. __header ` #include <boost/type_traits/make_unsigned.hpp>` or ` #include <boost/type_traits.hpp>`
  25. [table Examples
  26. [ [Expression] [Result Type]]
  27. [[`make_unsigned<int>::type`][`unsigned int`]]
  28. [[`make_unsigned<unsigned int const>::type`] [`unsigned int const`]]
  29. [[`make_unsigned<const unsigned long long>::type`] [`const unsigned long long`]]
  30. [[`make_unsigned<my_enum>::type`] [An unsigned integer type with the same width as the enum.]]
  31. [[`make_unsigned<wchar_t>::type`] [An unsigned integer type with the same width as wchar_t.]]
  32. ]
  33. [endsect]