ptal/expected

[Monads] extract pointer_like category and the specialization for value_traits to a pointer_like.hpp

Closed this issue · 1 comments

namespace category
{
  struct pointer_like {};
}

template <>
struct value_traits<category::pointer_like> {
  template <class M>
  using type = typename M::value_type;
  template <class M>
  static constexpr bool has_value(M&& m) { return bool(m); };
  template <class M>
  static constexpr auto derreference(M&& m) -> decltype(*m) { return *m; };
};

Vicente J. Botet Escriba Moved have_value and pointer_like. fixes #3 & #8.
d504e88