Can dot operator be used to make a ".." range ?

76 views
Skip to first unread message

Cleiton Santoia

unread,
Aug 9, 2017, 7:44:12 PM8/9/17
to ISO C++ Standard - Future Proposals
Can I do a double "." ? 

struct iterator{

   
struct first_leg {
     iterator
& it_;
     first_leg(const iterator& it) : it_(it) {}
     Range operator.(const iterator &end) { return Range(it_, end); };
   
}

   first_leg 
operator.() { return 
first_leg(*this); }
}

iterator a = c.begin();
iterator b = c.end()
Range x = a..b; 
// dot operator twice ?

for ( auto i : x ) { 
// code...
}

BR
Cleiton

Nicol Bolas

unread,
Aug 9, 2017, 11:14:02 PM8/9/17
to ISO C++ Standard - Future Proposals
If you're talking about Stroustrup's operator-dot proposal, no; `..` would still be syntactic nonsense. The proposed `operator.` doesn't really override the use of the `.` grammar. It overrides essentially all operations that would access that type through a variable or reference to an object.
Reply all
Reply to author
Forward
0 new messages