ptal / expected

What did you expect?
113 stars 18 forks source link

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

Closed viboes closed 10 years ago

viboes commented 10 years ago
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; };
};
viboes commented 10 years ago

Vicente J. Botet Escriba Moved have_value and pointer_like. fixes #3 & #8. https://github.com/ptal/Boost.Expected/commit/d504e8831e05b163160cbd0453dcd1329c1dc2ae