I get tired of writing a pair of iterators and make a View class.
I don't get why the make_range function doesn't work unless I remove the View(View<C>& r) constructor.
But that doesn't make sense. The make_range function doesn't use that constructor.
The code is also at https://godbolt.org/g/75sWPf
Thanks.
Test:
#include <vector>
template<typename C>
class View {
public:
    typedef typename C::iterator iterator;
    View(C& c, iterator begin, iterator end) :
            _c(c) {
        _begin = c.begin();
        _end = c.end();
    }
    // Remove a constructor
    // View(View<C>& r) : _c(r._c) {
    //     _begin = r._begin;
    //     _end = r._end;
    // }
private:
    C& _c;
    iterator _begin;
    iterator _end;
};
template<typename T, typename A>
View<std::vector<T, A> > make_view(std::vector<T, A>& v) {
    View<std::vector<T, A> > a(v, v.begin(), v.end());
    return a;
};
int main() {
    std::vector<int> a;
    for (int i = 0; i < 5; ++i) a.push_back(i);
    View<std::vector<int>> b(a, a.begin(), a.end());
    // this works.
    // View<std::vector<int>> c(b);  
    // doesn't work unless I remove constructor.
    auto d = make_view(a);  
}
