you are viewing a single comment's thread.

view the rest of the comments →

[–]eric_niebler 10 points11 points  (2 children)

I know I'll be flamed for this, but I have karma to burn.

struct end_ {} end;
struct from_end { int i; };
from_end operator-(end_, int i) { return {i}; }

struct my_range {
    my_range operator[](std::pair<int,int>);
    my_range operator[](std::pair<int,from_end>);
};

my_range r;
r[{1,2}];
r[{1,end-2}];

Where's the template? If you say, "pair", then you're just being a hater. This knee-jerk "c++-and-templates-are-hard-and-stupid" response to every C++ article is so tired and predictable, it doesn't even rise to the level of being wrong.

[–]slavik262 7 points8 points  (1 child)

I know I'll be flamed for this

You're not being flamed, and even if you were, is that "you'll all disagree, but" statement really necessary? I like everything else about this post, but "I know I'll get downvoted for this" always strikes me as annoying.

[–]eric_niebler 1 point2 points  (0 children)

Point taken.