lefticus / cpp_weekly

The official C++ Weekly Repository. Code samples and notes of future / past episodes will land here at various times. PR's will be accepted in some cases.
The Unlicense
701 stars 26 forks source link

Could anybody make a proposal? Thanks. #77

Open YagaoDirac opened 2 years ago

YagaoDirac commented 2 years ago

I was watching https://www.youtube.com/watch?v=PJ-byW33-Hs just now. The auto works for most of the cases except for some intermediate special classes. I don't remember that clearly but I remember I've come up with an idea of something like: [[auto_as]] iterator_ref operator[](int i){/some code/} Then when people call this function and restore the return value in a auto variable, it should look like: auto result = some_object[42]; The type of result should be bool rather than a proxy class. One of the examples is that when index or something with the std::vector, it returns the so-called intermediate proxy class. This is also mentioned in Scott Mayer's book(probably 2014 or 2015 or so). I don't know how to make a proposal and even if I would really do that, it's unlikely to be seen. So, anybody please help. Thanks.

lefticus commented 2 years ago

Yes, anyone can make a proposal. Please update the title to be more specific about the topic you want covered.