Open h-2 opened 4 years ago
Great article!
I noticed a problem with the markdown inside the collapsing elements, particularly the last one named "Here is the solution". Just wanted to mention it if it had gone unnoticed so far :-)
This is honestly the best guide I've found trying to understand Ranges and their relationship to Iterators. Great work.
I did notice a formatting issue in the code samples on my device: line numbers are appearing immediately to the left of the code. This makes it harder to read (though the change in color alleviates it).
.
Is there function like std::ranges::uniq :: range
Thank you for the article. Would std::views have any performance implications?
Slowly catching up with the comments 😇
@NBJack :
This is honestly the best guide I've found trying to understand Ranges and their relationship to Iterators. Great work.
Thank you very much!
I did notice a formatting issue in the code samples on my device: line numbers are appearing immediately to the left of the code.
Yeah, I had some trouble with the blog, because I wanted rendering to happen server-side and not via javascript. This is apparently quite difficult in the modern days ™️ . I plan to update the blog system sometime soon and then also improve the code snippets.
@an146 :
Is there function like std::ranges::uniq :: range -> optional?
I am not sure what you want exactly. Are you looking for a view or are you looking for an algorithm that transforms a range into a single value (like a fold)?
@wxinix :
Thank you for the article. Would std::views have any performance implications?
Some of them do, some don't. It depends on the view and also on the type of the underlying range. In my experience, std::views::transform
on top of something like a vector or array has almost no impact. The same goes for "slicing" views (take and drop).
I have measured a little overhead for filter-views, but this depends also on how predictable the predicate is that you are evaluating. I wrote more on this in my thesis:
https://refubium.fu-berlin.de/bitstream/handle/fub188/30952/dissertation_hauswedell_refubium_version2.pdf?sequence=3&isAllowed=y (page 166 and following).
It took a while, but all formatting issues should be fixed (I hope).
Very helpful post! I came here searching for the difference between C++ spans, ranges, and views, and this article explained it clearly and succinctly.
One complaint about styling though: in the table under “well-known containers from the standard library” the column headers are very hard to read. There is barely any contrast between the green background and light grey text colors.
Very helpful post! I came here searching for the difference between C++ spans, ranges, and views, and this article explained it clearly and succinctly.
Thank you!
One complaint about styling though: in the table under “well-known containers from the standard library” the column headers are very hard to read. There is barely any contrast between the green background and light grey text colors.
Fixed it!
A very useful introduction to C++ ranges! Brief and to the point. Thank you!
See https://hannes.hauswedell.net/post/2019/11/30/range_intro/