Micro template library A library for building device drivers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

62 lines
1.8 KiB

  1. /*!
  2. * \file detection.h
  3. * \brief Detection idiom based on WG21's N4502[1] from Walter E. Brown
  4. *
  5. * [1]: www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf
  6. *
  7. * Copyright (C) 2018-2019 Christos Choutouridis
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Lesser General Public License as
  11. * published by the Free Software Foundation, either version 3
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. #ifndef __utl_meta_detection_h__
  23. #define __utl_meta_detection_h__
  24. #include <utl/core/impl.h>
  25. #include <utl/meta/logical.h>
  26. #include <type_traits>
  27. /*!
  28. * \ingroup meta
  29. * \defgroup detection
  30. * Detection idiom support header.
  31. */
  32. //! @{
  33. namespace utl {
  34. namespace meta {
  35. /*!
  36. * void_t meta-function that maps a sequence of any types to the type void
  37. */
  38. //! @{
  39. #if defined(UTL_WORKAROUND_CWG_1558)
  40. template<typename... _Ts>
  41. struct void_ {
  42. using type = void;
  43. };
  44. //! void_t type alias
  45. template<typename... _Ts>
  46. using void_t = eval<void_<_Ts...>>;
  47. #else
  48. //! void_ type alias
  49. template <typename...> using void_ = void;
  50. //! void_t type alias
  51. template <typename...> using void_t = void;
  52. #endif
  53. //! @}
  54. }}
  55. //!@}
  56. #endif /* __utl_meta_void_h__ */