7 ms·
C++ Internals: STL Vector, Part 3
- jjuhl 11y agoOnce one ignores the broken english, there's a lot of useful info here - not really anything new, but still useful.
- autoreleasepool 11y agoThe scrolling experience on this page is awful on my retina MacBook Pro.
- Retra 11y agoI'm curious why anyone would reimplement scrolling in a webpage when the browser already does it. It's not even an interesting problem...
- nilliams 11y agoI guess the author/library is unable to detect users for which this would worsen things. For me, it does actually work as an improvement on my non-smooth-scroll mousewheel.
- thezilch 11y agoNot sure it reimplements scrolling; it just looks like there are CSS styles applied to browsers supporting ::webkit-scrollbar-* selectors and coloring/thinning the scrollbar.
- gahcep 11y agoIt's the ghost.io blogging platform. It had in past such issues. And obviously has it now...
- gahcep 11y agoActually, it's not the ghost.io, it's a custom theme. Soon it will be replaced.
- sdab 11y agoThe author (gahcep) and Stephan (STL, stl maintainer for microsoft) are on r/cpp. https://www.reddit.com/r/cpp/comments/3gd29t/c_internals_stl_vector_part_iii_custom_allocator/ https://www.reddit.com/r/cpp/comments/3gd29t/c_internals_stl...
- StephanTLavavej 11y agoIt's amusing to see somebody going through work I did 8 years ago!
- cjslep 11y agoAs someone that uses Microsoft's STL, I just wanted to let you know I appreciate your work. Stepping through the STL (whether on purpose or via accidental F11 instead of F10) has made me a better programmer. I mean it sincerely!
- gahcep 11y agoYes, I went through because I wanted to know the details. It's nice, you were amused.
- overgard 11y agoI know this is a nitpick, but "auto main() -> int" seems weird to me. "int main()" is not only more understandable, but also shorter.
- StephanTLavavej 11y agoYep, that's a totally counterproductive use of trailing return types. There are several reasons to use trailing return types, but that's not one of them. (The major use is when you have to refer to function parameters with decltype. Additional uses are when the return type would have to be qualified on the left but can be shorter on the right, or when you're returning something like a function pointer or reference to array and you don't have a convenient typedef/alias.)
- detrino 11y agoOne could argue that trailing return types are more consistent and allow you to switch between return type deduction and explicit return types easier.
- AdieuToLogic 11y agoOne could present that argument, yes, but would be questioned as to why the argument is needed for the canonical main function definition. Usage of this syntax for main not only deviates from expected form, its presence in defining the one function every C++ developer knows by heart is self-defeating.
- deleted 11y ago[deleted]
- detrino 11y agoWhat a long winded way to say "that syntax is weird" while totally ignoring that my main point was consistency.
- byuu 11y ago
- thrownaway2424 11y agoThe link to simple_allocator.hpp is a 404.
- gahcep 11y agoFixed.
- AdieuToLogic 11y agoUsing a custom allocator with standard collections can be highly useful, as the article points out. I do recommend defining your own container deriving from a type such as std::vector using private inheritance, and exposing the base definitions via the "using" keyword and replicating applicable typedefs/constructors. Doing so will help prevent "interesting" behaviour and help expose assumptive template definitions in a code base.
- adamzubi 11y agohttp://googler700.blogspot.com/ http://googler700.blogspot.com/