Closed rosds closed 3 years ago
Looks good. I haven't been following C++. Is there a compiler that could type check this code?
Hi :) I could compile with the latest gcc. The only feature that is still not yet supported by gcc is the constexpr std::string. But it is in the C++20 standard so hopefully it will be supported soon enough.
here is the version with a string literal instead of std::string: https://godbolt.org/z/nnaEs6
I asked my friend Eric Niebler for comments. This is what he said.
\begin{snip}{cpp}
template
I would probably just forward-declare this but leave the primary template undefined.
template
Probably you don't want to use a class static here. Not all types have a constexpr default constructor, and you don't want to introduce order-of-initialization issues. Maybe a static member function named value() that returns the empty value.
template
template
If you went with a static member function, this would be:
{ mempty
And see below about "same_as".
{ mappend(m, m) } -> std::convertible_to<M>;
};
I would strengthen "convertible_to" to "same_as". There's no reason not to turn the screws down tightly here.
Thanks for the comments :) I have to agree with that
So what's the verdict? Can I merge this? :)
If we can incorporate Eric's comments, then yes.
If we can incorporate Eric's comments, then yes.
I'd incorporate them some days ago, just have a look :)
Cool! Thanks!
Will gonna need a ruling here. @BartoszMilewski, WDYT?