Say I have some template function that returns the median of some iterable object passed into it.
Something like:
template<typename T>
decltype(auto) find_median_sorted(T begin)
{
// some code here
}
Now I want to make sure I constrained T to always be iterable. I am trying to learn how to use concepts in C++, so is there some way I can use concept here to make sure T is iterable?
I'm sure there are other ways to check if it is iterable, but is this a wrong use case for concepts?
I also came across this post here related to element iterable, but I am not sure how this applies to my case.