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.
 
 
 
 

70 lines
1.8 KiB

  1. /*!
  2. * \file /utl/concepts/defines.h
  3. * \brief Concepts defines
  4. *
  5. * Copyright (C) 2018-2019 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. */
  21. #ifndef __utl_concepts_defines_h__
  22. #define __utl_concepts_defines_h__
  23. //!\defgroup concepts
  24. //!@{
  25. /*!
  26. * \brief
  27. * utl typename constraints wrapper
  28. *
  29. * \example
  30. * \code
  31. * template <utlConstrainType(SomeConcept) T> struct lala { };
  32. * // will expand to something like:
  33. * // template <SomeConcept T> struct lala { };
  34. * // or
  35. * // template <typename T> struct lala { };
  36. * \endcode
  37. */
  38. #if CXX_CONCEPTS
  39. #define utlConstrainType(_Concept_) _Concept_
  40. #else
  41. #define utlConstrainType(_Concept_) typename
  42. #endif
  43. /*! \brief
  44. * utl concept keyword syntax wrapper
  45. */
  46. #if CXX_CONCEPTS
  47. #if __cpp_concepts <= 201507L
  48. #define _utlConcept concept bool
  49. #else
  50. #define _utlConcept concept
  51. #endif
  52. #else
  53. #define _utlConcept constexpr bool
  54. #endif
  55. #ifndef CXX_LIB_INVOKE
  56. #ifdef __cpp_lib_invoke
  57. #define CXX_LIB_INVOKE __cpp_lib_invoke
  58. #else
  59. #define CXX_LIB_INVOKE 0
  60. #endif
  61. #endif
  62. //! @}
  63. #endif /* __utl_concepts_defines_h__ */