Should this work?

Craig Dillabaugh cdillaba at cg.scs.carleton.ca
Fri Jan 10 12:41:41 PST 2014


On Friday, 10 January 2014 at 19:32:24 UTC, Atila Neves wrote:
> I agree that std.algorithm is better than <algorithm>, but 
> let's not pretend that C++11 never happened (that happens from 
> time to time on this forum). The modern C++ version isn't 
> _that_ different:
>
>     for(auto& blah: myContainer) { //for-loop condition on one 
> line
>         doSomething(blah->impl->myDataField);
>         if(find(blah->impl->mySubContainer.begin(), 
> blah->impl->mySubContainer.end(), key) == 
> blah->impl->mySubContainer.end()) {
>             //decltype is way shorter than 
> std::vector<MyType<Blah>>
>             //and change-resistant
>             return decltype(blah)::iterator{};
>         }
>      }
>
> Again, I think that std.algorithm is better and that passing a 
> pair of iterators to everything when 99.9% of the time they'll 
> be begin() and end() anyway is a massive PITA. I'm a D convert. 
> Nobody here makes a point of posting D1 code and IMHO there's 
> also no point in posting C++98 / C++2003 code.
>
> Atila
>

In our company we have people working with Visual Studio 2005, so 
when I am working on common code I still have to avoid any new 
C++ features! I am 'really' trying to get them to upgrade!

Craig



More information about the Digitalmars-d mailing list