filmov
tv
What a View! Building Your Own (Lazy) Range Adaptors (part 2 of 2) - Chris Di Bella - CppCon 2019
Показать описание
—
What a View! Building Your Own (Lazy) Range Adaptors (part 2 of 2)
With their addition to C++20, ranges -- a revamped STL -- are going to send shockwaves through the way in which we design our software. The work from ranges gives us three broad things in C++20: redefined algorithms, concepts to assist in these algorithm definitions, and a handful of range adaptors, which are an abstraction over iterators for convenient program composition.
As Alex Stepanov and Sean Parent have said, the algorithms from the STL are only a sample of the algorithms that exist, and you're able to write your own. Range adaptors are no different: just because the adaptor you need isn't in C++20, doesn't mean that you can't write (or propose) it.
Using custom range adaptors can help you express your intentions in a much clearer manner. We'll spend some time implementing a range adaptor that isn't in the pipeline for C++20, starting from a motivating use-case, then move to how we implement the range adaptor -- including design considerations -- and finally, we'll write up a few tests to wrap everything up.
—
Christopher Di Bella
Christopher Di Bella is a Staff Software Engineer for Codeplay’s ComputeCpp Runtime Technology. He is a strong proponent for generic programming in C++ and C++ education. Chris was previously a software developer for Nasdaq, and a tutor for UNSW Australia’s COMP6771 Advanced C++ Programming course in Sydney, Australia. When not geeking out over C++, he enjoys snowboarding, playing games, and watching films.
—
*-----*
*-----*
What a View! Building Your Own (Lazy) Range Adaptors (part 2 of 2)
With their addition to C++20, ranges -- a revamped STL -- are going to send shockwaves through the way in which we design our software. The work from ranges gives us three broad things in C++20: redefined algorithms, concepts to assist in these algorithm definitions, and a handful of range adaptors, which are an abstraction over iterators for convenient program composition.
As Alex Stepanov and Sean Parent have said, the algorithms from the STL are only a sample of the algorithms that exist, and you're able to write your own. Range adaptors are no different: just because the adaptor you need isn't in C++20, doesn't mean that you can't write (or propose) it.
Using custom range adaptors can help you express your intentions in a much clearer manner. We'll spend some time implementing a range adaptor that isn't in the pipeline for C++20, starting from a motivating use-case, then move to how we implement the range adaptor -- including design considerations -- and finally, we'll write up a few tests to wrap everything up.
—
Christopher Di Bella
Christopher Di Bella is a Staff Software Engineer for Codeplay’s ComputeCpp Runtime Technology. He is a strong proponent for generic programming in C++ and C++ education. Chris was previously a software developer for Nasdaq, and a tutor for UNSW Australia’s COMP6771 Advanced C++ Programming course in Sydney, Australia. When not geeking out over C++, he enjoys snowboarding, playing games, and watching films.
—
*-----*
*-----*
Комментарии