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.5 KiB

  1. #pragma once
  2. #include "modifier.h"
  3. #include "modifiers.h"
  4. namespace cpphibernate
  5. {
  6. namespace __impl
  7. {
  8. /* modifiers_t */
  9. template<typename... T_modifiers>
  10. using modifiers_t = hana::basic_tuple<T_modifiers...>;
  11. /* modifiers_builder */
  12. template<typename T, typename>
  13. struct modifiers_builder
  14. {
  15. template<typename... T_args>
  16. static constexpr decltype(auto) apply(T_args&&...)
  17. { static_assert(sizeof...(T_args) == -1, "Invalid parameters for make_modifiers(...)!"); }
  18. };
  19. template<typename... T_args>
  20. struct modifiers_builder<
  21. mp::list<T_args...>,
  22. mp::enable_if_t<
  23. mp::is_true_v<is_modifier_v<mp::decay_t<T_args>>...>>>
  24. {
  25. static constexpr decltype(auto) apply(T_args&&... args)
  26. {
  27. using modifiers_type = modifiers_t<T_args...>;
  28. return modifiers_type(std::forward<T_args>(args)...);
  29. }
  30. };
  31. /* is_modifiers_impl */
  32. template<typename T, typename = void>
  33. struct is_modifiers_impl
  34. : mp::false_t
  35. { };
  36. template<typename... T>
  37. struct is_modifiers_impl<
  38. modifiers_t<T...>,
  39. mp::enable_if_t<mp::is_true_v<is_modifier_v<mp::decay_t<T>>...>>>
  40. : mp::true_t
  41. { };
  42. }
  43. /* is_modifiers */
  44. template<typename T>
  45. struct is_modifiers
  46. : public __impl::is_modifiers_impl<T>
  47. { };
  48. }