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.
 
 
 
 

64 lines
1.6 KiB

  1. /*!
  2. * \file void.h
  3. * \brief Template meta-programming void helpers
  4. *
  5. * Copyright (C) 2018 Christos Choutouridis
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation, either version 3
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef __utl_meta_void_h__
  21. #define __utl_meta_void_h__
  22. #include <utl/impl/impl.h>
  23. #include <utl/meta/bool.h>
  24. /*! \ingroup meta
  25. * \defgroup void
  26. * void_ support header
  27. */
  28. //! @{
  29. namespace utl {
  30. /*!
  31. * Like boost::mpl we made void_ a complete type to allow it to be
  32. * instantiated so that it can be passed in as an object that can be
  33. * used to select an overloaded function.
  34. */
  35. struct void_ {
  36. typedef void_ type;
  37. };
  38. template<typename _Tp>
  39. struct is_void_
  40. : false_ { };
  41. template<>
  42. struct is_void_ <void_>
  43. : true_ { };
  44. template<typename _Tp>
  45. struct is_not_void_
  46. : true_ { };
  47. template<>
  48. struct is_not_void_<void_>
  49. : false_ { };
  50. }
  51. //!@}
  52. #endif /* __utl_meta_void_h__ */