
C++ Internals: STL Vector, Part 3 - ingve
http://www.gahcep.com/cpp-internals-stl-vector-part-3/
======
overgard
I know this is a nitpick, but "auto main() -> int" seems weird to me. "int
main()" is not only more understandable, but also shorter.

~~~
andrepd
And just a few lines below that: "for (auto item : { 1, 2, 3, 4, 5, 6, 7, 8, 9
})". Why?? It's an almost comical abuse of C++11 for the sake of it.

~~~
nadams
> And just a few lines below that: "for (auto item : { 1, 2, 3, 4, 5, 6, 7, 8,
> 9 })". Why?? It's an almost comical abuse of C++11 for the sake of it.

This comment is very interesting. His syntax reminds me of Python syntax of:

    
    
        for i in [1,2,3]:
    

Isn't that what the future C++ is trying to achieve? Simplified syntax?

~~~
srean
> Isn't that what the future C++ is trying to achieve? Simplified syntax?

I think your question was rhetorical, in any case the answer is yes. In fact
the proposed C++ pythy syntax tries go even further
[http://pfultz2.github.io/Pythy/](http://pfultz2.github.io/Pythy/) . IIRC its
Clang only. Its author hangs out on HN sometimes and would be able to provide
more information

------
autoreleasepool
The scrolling experience on this page is awful on my retina MacBook Pro.

~~~
Retra
I'm curious why anyone would reimplement scrolling in a webpage when the
browser already does it. It's not even an interesting problem...

~~~
thezilch
Not sure it reimplements scrolling; it just looks like there are CSS styles
applied to browsers supporting ::webkit-scrollbar-* selectors and
coloring/thinning the scrollbar.

------
jjuhl
Once one ignores the broken english, there's a lot of useful info here - not
really anything new, but still useful.

~~~
Fede_V
Yeah, this is a brilliant series of articles. I really enjoyed it.

------
sdab
The author (gahcep) and Stephan (STL, stl maintainer for microsoft) are on
r/cpp.

[https://www.reddit.com/r/cpp/comments/3gd29t/c_internals_stl...](https://www.reddit.com/r/cpp/comments/3gd29t/c_internals_stl_vector_part_iii_custom_allocator/)

~~~
StephanTLavavej
It's amusing to see somebody going through work I did 8 years ago!

~~~
cjslep
As 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!

------
AdieuToLogic
Using 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.

------
thrownaway2424
The link to simple_allocator.hpp is a 404.

~~~
gahcep
Fixed.

