How can I programatically implement a concept as if it were an actual "interface"?
For example, I was trying recently to write a contigious iterator for a custom container. And because contigious iterators have a lot of traits, I wanted to make sure I didn't miss anything, so I used a static assert like the following:
struct CustomContainer
{
struct Iterator
{
using iterator_category = std::contiguous_iterator_tag;
/* Iterator impl */
};
static_assert(std::contiguous_iterator<Iterator>);
};
Problem with that is the compiler just says "static assertion failed" and doesn't give me a hint what is actually missing from my implementation to satisfy the concept.
So, is there a better approach to this that I should know about?