vittorioromeo / scelta

(experimental) Syntactic sugar for variant and optional types.
https://vittorioromeo.info
MIT License
157 stars 10 forks source link

Monadic operations don't support member pointers #12

Open TartanLlama opened 6 years ago

TartanLlama commented 6 years ago

The monadic operations use f() syntax to call the function objects they're given. I think supporting member function/data pointers through std::invoke would be good so that users can write code like:

optional<string> s;
auto opt_size = map(s, &string::size);
vittorioromeo commented 6 years ago

I'm a little bit ambivalent about this as std::invoke is not constexpr - I would have to add an extra non-constexpr overload for member function pointers... will think about it :)