News for hackers. Stuff that matters.
Re:Making Your Own Container Compatible with C++20 Ranges by monocasa on Monday March 22, 2021 @07:56PM (#26549159)
This kind of thing is easily one of my favorite pieces of C++. I used to be the OS lead for a proprietary C++14 RTOS, and being able to build our own intrusive collections libraries that were able to use all the same syntax sugar as the STL was absolutely killer.

IMO, all systems languages should be expressive enough to implement their standard libraries and containers as normal language code, but sadly that isn't always the case.

Re:Making Your Own Container Compatible with C++20 Ranges by slavik81 on Monday March 22, 2021 @08:14PM (#26549296)
> One of my fundamental aims for C++ is (from the very start in 1979) to provide equally good support for user-defined and built-in types. For example, I’d like to be able to build an integer type that is as good as the built-in int in every way (with the possible exception of compile time).

~ Bjarne Stroustrup, How can you be so certain? (2019)

Re:Making Your Own Container Compatible with C++20 Ranges by pjmlp on Tuesday March 23, 2021 @03:05AM (#26551929)
Which made me an early adopter in 1993 for MS-DOS, as C already felt primitive back then.

However I still dream of the day where static analysis can fix all possible security issues.

Re:Making Your Own Container Compatible with C++20 Ranges by nicoburns on Tuesday March 23, 2021 @05:59AM (#26553056)
Which systems languages can't do this?
Re:Making Your Own Container Compatible with C++20 Ranges by rfoo on Wednesday March 24, 2021 @03:40AM (#26564507)
The only one I'm aware of is Golang.
Re:Making Your Own Container Compatible with C++20 Ranges by nly on Monday March 22, 2021 @10:09PM (#26550178)
I'm not sure if this situation has improved in C++20, but writing iterator types properly in classic C++ really sucks, and this article glosses over a lot of the details.

I've always used Boosts iterator_facade to do this: https://www.boost.org/doc/libs/1_75_0/libs/iterator/doc/iter... , which requires you only implement a maximum of 6 functions for any iterator type.

Re:Making Your Own Container Compatible with C++20 Ranges by _slyo on Monday March 22, 2021 @10:25PM (#26550288)
Boost.STLInterfaces provides a more modern alternative to iterator_facade.

https://www.boost.org/doc/libs/1_75_0/doc/html/stl_interface...

Re:Making Your Own Container Compatible with C++20 Ranges by nly on Monday March 22, 2021 @11:25PM (#26550708)
Yes, indeed! Thanks
Re:Making Your Own Container Compatible with C++20 Ranges by _huayra_ on Tuesday March 23, 2021 @04:51AM (#26552596)
The author gave a great talk on this at cppcon last year: https://www.youtube.com/watch?v=JByCzWaGxhE
Re:Making Your Own Container Compatible with C++20 Ranges by fefe23 on Tuesday March 23, 2021 @04:38AM (#26552503)
I find it pretty funny that the article opens with "so we don't need all that SFINAE junk anymore" and then proceeds to spend pages upon pages explaining the other junk we need in its place :-)

I know, apples to oranges, the SFINAE bit was about concepts, not iterators. Still, pretty funny.