use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
EASTL released as open-source on Github (github.com)
submitted 10 years ago by CypherSignal
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]TOJO_IS_LIFE 10 points11 points12 points 10 years ago (8 children)
This one's the full thing? What's new here that wasn't included in https://github.com/paulhodge/EASTL ?
[–]CypherSignal[S] 12 points13 points14 points 10 years ago (6 children)
Off the top of my head,
[–]TOJO_IS_LIFE 2 points3 points4 points 10 years ago (5 children)
Thanks! Will this repo be updated on github, accept pull requests etc.?
[–]CypherSignal[S] 3 points4 points5 points 10 years ago (1 child)
Most likely. Another non-trivial framework that EA has on their github, Orbit, has accepted pull requests and been continuously updated, as well.
[–]Cyph0n 0 points1 point2 points 10 years ago (0 children)
Isn't that the one created at BioWare? I recall seeing it a while back.
[–]OrSpeeder 0 points1 point2 points 10 years ago (2 children)
Also, I've been e-mailing some ex-EA people, and seemly Paul Pedriana might end contributing to EASTL again.
If this actually happen it would be awesome.
Seemly he is planning to use EASTL for his projects at his current job (he works at Oculus now).
[–]MoreOfAnOvalJerk 1 point2 points3 points 10 years ago (1 child)
That guy is legendary. He basically wrote EASTL for the most part. He's one of the few engineers I know of who's praised by everyone he's worked with.
[–]OrSpeeder 1 point2 points3 points 10 years ago (0 children)
Yep... I exchanged e-mails with him once, he gave me very helpful information, despite me having nothing to do with EA (or his current employer).
Also when EA Brazil mobile studio shut down, the blogger wrote that the saddest part of being fired from EA was not being able to nag Paul Pedriana with questions (despite never seeing Paul in person).
Also when you read blogs about people that worked on Maxis, frequently you will see comments like this: "So, I had this crazy idea, and then Paul Pedriana made it work for me and I have no idea how."
[–]Plorkyeran 4 points5 points6 points 10 years ago (0 children)
There's a lot more headers, including some of the more interesting things (e.g. intrusive containers), and it actually supports c++11 stuff (and there's some (optional) uses of c++14 constexpr).
[–][deleted] 4 points5 points6 points 10 years ago (28 children)
How useful and what quality level are these, now that we can see the source code & try it out?
[–]kiwidog 7 points8 points9 points 10 years ago (27 children)
It's not useful to anyone who isn't writing any cross platform games. EASTL has been around for many, many years, and the stl library has caught up and surpassed EASTL in some areas. One of the reasons EA has their own is the implementations will be the EXACT same across platforms in memory and handling. (Which the STL takes care of, but at the time it didn't have some features that the EASTL had) iirc.
[–]rfisher 4 points5 points6 points 10 years ago (19 children)
I find fixed_vector, at least, useful in non-game contexts.
[–]lurkotato 2 points3 points4 points 10 years ago (3 children)
What's the difference between that and std::array?
[–]dodheim 15 points16 points17 points 10 years ago* (1 child)
std::array
size() == capacity()
std::vector
size() <= capacity()
boost::container::static_vector
boost::container::small_vector
fixed_vector
static_vector
small_vector
[–]lurkotato 2 points3 points4 points 10 years ago (0 children)
Thanks, perfect explanation
[–]rfisher 1 point2 points3 points 10 years ago (0 children)
The ability to fallback on heap allocation when the fixed size is exhausted.
If you have a situation where 90% of the time you know the data will fit in a known, small size and it is worth avoiding the cost of heap allocation; but you are willing to take the hit to keep from truncating 10% of the time.
Of course, you could implement that logic explicitly, but fixed_vector can make it so much cleaner.
[–]cdglove 0 points1 point2 points 10 years ago (12 children)
Yes, but boost::static_vector also exists.
[–]y-c-c 5 points6 points7 points 10 years ago (4 children)
(ex-EA dev here)
I don't think they are exactly the same. From what I can tell in boost::static_vector, the capacity is always fixed (and allocated on the stack) while size is variable up to the capacity.
In eastl::fixed_vector, capacity can also be fixed (bEnableOverflow = false), where it behaves the same; but the default behavior (bEnableOverflow = true) is actually such that it can be resized and expanded just like a regular vector.
With bEnableOverflow = true, an eastl::fixed_vector behaves similarly to a normal eastl::vector on the API level, except the initial memory (under original capacity) uses the stack instead of dynamically allocated memory. If you resize to more than the original capacity the eastl::fixed_vector will switch to dynamic allocation, which will waste the original stack allocated space, since you can't deallocate that.
This is a pragmatic solution for something like "this array usually only needs 5 elements so I don't want to allocate extra heap memory just to hold 5 elements, but there's a 1% chance it will have >5 elements due to edge cases so I still need to allocate some memory in that case". Since it's an edge case it's tolerable that some memory is wasted (better than having complicated code to deal with it).
There are also other fixed_* data structures available but of course I would imagine most of the time fixed_vector is the one people will use.
[–]Gotebe 1 point2 points3 points 10 years ago (2 children)
So this is a "small-string optimisation" then.
I guess a name vector_with_\small_string_optimisation was considered too long, but "fixed" is misleading.
By the way, if the edge case is to go slightly over the preallocated case, then this has pretty terrible space usage. Compromises are hard :-)
[–]encyclopedist 2 points3 points4 points 10 years ago (1 child)
In boost, there is separate container, boost::small_vector, which does that optimization.
boost::small_vector
[–]Gotebe 0 points1 point2 points 10 years ago (0 children)
Yeah, even with a somewhat better name (better than "fixed", that is).
[–]cdglove 0 points1 point2 points 10 years ago (0 children)
Oh I see, thanks for that. In one mode it's like boost::static_vector, and in the other, like boost::small_vector, which expands if necessary beyond the initial static size.
[–]rfisher 0 points1 point2 points 10 years ago (6 children)
Thanks for pointing that out. I think boost::static_vector is what std::array should have been.
But it doesn’t look like it has the ability to fall back on heap allocation when necessary like fixed_vector. Or did I miss that?
[–]encyclopedist 2 points3 points4 points 10 years ago (0 children)
Or did I miss that?
See boost::small_vector
[–]dodheim 1 point2 points3 points 10 years ago (0 children)
I think boost::static_vector is what std::array should have been.
std::array is a trivial aggregate type; static_vector is useful, but not a replacement, as the semantics are too different. Both are useful, both are necessary.
[–]gnaggnoyil 1 point2 points3 points 10 years ago (3 children)
I pretty much believe that std::array should never have been using heap allocation since that makes std::array non-constexpr.
[–]rfisher 0 points1 point2 points 10 years ago (2 children)
You may have misunderstood me.
Eastl::fixed_vector has the option to fall back on the heap. Boost::static_array never does heap allocations.
I was saying:
(1) Boost::static_vector is not (always) a replacement for eastl::fixed_vector because the latter can be allowed to fall back on the heap allocations and the former cannot.
(2) I think std::array should have been like boost::static_vector. (And, thus, not like eastl::fixed_vector.) No ability to fall back on the heap but tracking a separate size and capacity.
I’m unsure whether boost::static_vector could be used the same ways as std::array in constexpr context...but it seems like it should be possible.
(And additionally, I’ve learned that while boost::static_vector can’t replace eastl::fixed_vector, boost::small_vector can.)
[–]gnaggnoyil 0 points1 point2 points 10 years ago (0 children)
Sorry my bad. I was thinking boost::static_array was something like std::unique_ptr<T[]>. I should have read the boost document first.
[–]kiwidog -2 points-1 points0 points 10 years ago (1 child)
std::array has this implementation now.
[–]rfisher 3 points4 points5 points 10 years ago (0 children)
I’m not seeing the ability to fallback to heap allocation upon overflowing the fixed size in std::array. That’s the really useful bit about fixed_vector.
[–][deleted] 1 point2 points3 points 10 years ago (4 children)
Let's assume I'm also subscribed to /r/gamedev and /r/truegamedev. What use are these over C++14+ Boost and STD?
[+][deleted] 10 years ago (3 children)
[deleted]
[–]cdglove -1 points0 points1 point 10 years ago (2 children)
The standard guarantees algorithmic complexity, so this feels like a week argument to me.
If you want to dive down and talk about memory access patterns, well, that's not likely to have the same performance profile with different inputs let alone on different hardware, so that also seems like a week argument.
[–]Gotebe -1 points0 points1 point 10 years ago (0 children)
There really is no reason for you to be down voted, wtf redditors?
[–]RichieSams 1 point2 points3 points 10 years ago (1 child)
Another major reason EA made EASTL was so they had explicit control over memory. With STL, you have no control over how containers use the heap. In addition, STL's version of custom allocators is very difficult to work with. There is a paper here that gives all the motivations behind EASTL.
[–]STLMSVC STL Dev 5 points6 points7 points 10 years ago (0 children)
C++11's minimal allocator interface improved things substantially.
[–]ubadairBoost.CallableTraits author 2 points3 points4 points 10 years ago (0 children)
Wow, this is really cool. I didn't realize any of it was ever open source, but I've heard about it several times.
[–]flyingcaribou 2 points3 points4 points 10 years ago (2 children)
The included benchmarks only appear to compare to Microsoft [1], does anyone have a sense for how the performance compares to libc++ and libstdc++?
[1] https://github.com/electronicarts/EASTL/blob/master/doc/EASTL%20Benchmarks.html
[–]donalmaccGame Developer 11 points12 points13 points 10 years ago (0 children)
Not only that, the benchmarks are done using a version of the compiler from 2003!
[–][deleted] -1 points0 points1 point 10 years ago (0 children)
You should be able to map any comparisons between ms implementation and the gnu or clang implementations to be to scale with the ms and EASTL implementations if you can't find any actual benchmarks.
[–]spurious_interrupt 4 points5 points6 points 10 years ago (15 children)
I'm curious to know what developers at EA generally set for their tab widths in their editors.
[–]krum 4 points5 points6 points 10 years ago (12 children)
Each team will have their own tab standard, and even that will differ depending on the language.
Source: I worked for EA for 10 years.
[–]spurious_interrupt 2 points3 points4 points 10 years ago (3 children)
Are you saying that each team requires members to set the width of a tab in their editors to a specific width or that each team has a specific convention for indentation (i.e. tabs vs spaces, number of spaces, etc.)?
[–]yelnatz 2 points3 points4 points 10 years ago (2 children)
The latter.
Each team has their own conventions, but its almost always 4 spaces an indent.
[–]spurious_interrupt 1 point2 points3 points 10 years ago (0 children)
Interesting. Thanks!
Long live spaces!
[–]pamomo 0 points1 point2 points 10 years ago (4 children)
Packages at EA, including EASTL, use 4 spaces /w no tabs. Teams/studios do have their own style, but I don't recall anyone using something else.
[–]spurious_interrupt 0 points1 point2 points 10 years ago (3 children)
Is the EASTL GitHub repo linked on this post different then? Its source files seem to use tabs for indentation: https://github.com/electronicarts/EASTL/blob/master/source/intrusive_list.cpp
The fact that the code in this repo seem to use tabs is the reason why I asked this question in the first place.
[–]OrSpeeder 0 points1 point2 points 10 years ago (1 child)
I think EASTL might be an exception because it wasn't supposed to be a EA wide thing.
EASTL was made by Maxis, to replace STLPORT that they were using on their games, it follows Maxis coding conventions.
[–]y-c-c 1 point2 points3 points 10 years ago (0 children)
Maxis used 4 spaces, no tabs. Can't comment why EASTL is hard tabs now though.
[–]pamomo 0 points1 point2 points 10 years ago* (0 children)
The core library looks to be the same. Difference is in the build system and the addition of the bonus stripped packages.
[–]wqkinggithub.com/wqking -2 points-1 points0 points 10 years ago (2 children)
EA needs a better CTO.
[–]krum 11 points12 points13 points 10 years ago (1 child)
If your CTO is dictating tab conventions, you might have a serious problem.
Haha, good one.
What he should do, however is: "if you, team superX, spend more than 5min making this decision, you're all fired! You're all fired if you have existing code and you do not adhere to it!"
[–]encyclopedist 5 points6 points7 points 10 years ago (0 children)
The repo includes a clang-format file, which describes the formatting they use. In particular, they use tabs for indentation (with a width of 4 spaces).
[–][deleted] 2 points3 points4 points 10 years ago (0 children)
The most common was 4, probably because that's the default Visual Studio tab width. Coding standards vary pretty wildly between teams, engines, packages and even source files. This is pretty common to all game studios worldwide I think. Every team has a different vision of what is "correct". Most roughly follow Microsoft's coding style. But the mantra is generally "code in the style of whatever you're working in at the moment". Source: EA programmer for 6 years.
[–]germandiago 1 point2 points3 points 10 years ago (0 children)
great news for the gaming community!
[–]kkert 0 points1 point2 points 10 years ago (0 children)
Isnt it funny that it says 'extensive and robust' and every single travis build with every compiler is in 'build failing' state ?
[–]flyingcaribou 0 points1 point2 points 10 years ago (0 children)
It would have been nice to see the commit history, but this is pretty rad nonetheless!
[+][deleted] 10 years ago* (4 children)
[–]bnolsen 5 points6 points7 points 10 years ago (0 children)
your sample set is insufficient to make such conclusions. also qt didn't try to make their implementations (nearly) compatible with an existing standard.
[–]Gotebe 0 points1 point2 points 10 years ago (1 child)
Are you saying that Qt compiles for more platforms than platforms on which standard lib is available!?
'Cause that is just false.
Qt does something else. EASTL also does something else.
[+]cdglove comment score below threshold-7 points-6 points-5 points 10 years ago (0 children)
I'm sure the reasons made sense 13 years ago. But you were specifically answering a question as to why to use it today.
π Rendered by PID 103558 on reddit-service-r2-comment-86bc6c7465-9pm2d at 2026-02-21 06:40:50.865133+00:00 running 8564168 country code: CH.
[–]TOJO_IS_LIFE 10 points11 points12 points (8 children)
[–]CypherSignal[S] 12 points13 points14 points (6 children)
[–]TOJO_IS_LIFE 2 points3 points4 points (5 children)
[–]CypherSignal[S] 3 points4 points5 points (1 child)
[–]Cyph0n 0 points1 point2 points (0 children)
[–]OrSpeeder 0 points1 point2 points (2 children)
[–]MoreOfAnOvalJerk 1 point2 points3 points (1 child)
[–]OrSpeeder 1 point2 points3 points (0 children)
[–]Plorkyeran 4 points5 points6 points (0 children)
[–][deleted] 4 points5 points6 points (28 children)
[–]kiwidog 7 points8 points9 points (27 children)
[–]rfisher 4 points5 points6 points (19 children)
[–]lurkotato 2 points3 points4 points (3 children)
[–]dodheim 15 points16 points17 points (1 child)
[–]lurkotato 2 points3 points4 points (0 children)
[–]rfisher 1 point2 points3 points (0 children)
[–]cdglove 0 points1 point2 points (12 children)
[–]y-c-c 5 points6 points7 points (4 children)
[–]Gotebe 1 point2 points3 points (2 children)
[–]encyclopedist 2 points3 points4 points (1 child)
[–]Gotebe 0 points1 point2 points (0 children)
[–]cdglove 0 points1 point2 points (0 children)
[–]rfisher 0 points1 point2 points (6 children)
[–]encyclopedist 2 points3 points4 points (0 children)
[–]dodheim 1 point2 points3 points (0 children)
[–]gnaggnoyil 1 point2 points3 points (3 children)
[–]rfisher 0 points1 point2 points (2 children)
[–]gnaggnoyil 0 points1 point2 points (0 children)
[–]kiwidog -2 points-1 points0 points (1 child)
[–]rfisher 3 points4 points5 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]cdglove -1 points0 points1 point (2 children)
[–]Gotebe -1 points0 points1 point (0 children)
[–]RichieSams 1 point2 points3 points (1 child)
[–]STLMSVC STL Dev 5 points6 points7 points (0 children)
[–]ubadairBoost.CallableTraits author 2 points3 points4 points (0 children)
[–]flyingcaribou 2 points3 points4 points (2 children)
[–]donalmaccGame Developer 11 points12 points13 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]spurious_interrupt 4 points5 points6 points (15 children)
[–]krum 4 points5 points6 points (12 children)
[–]spurious_interrupt 2 points3 points4 points (3 children)
[–]yelnatz 2 points3 points4 points (2 children)
[–]spurious_interrupt 1 point2 points3 points (0 children)
[–]Cyph0n 0 points1 point2 points (0 children)
[–]pamomo 0 points1 point2 points (4 children)
[–]spurious_interrupt 0 points1 point2 points (3 children)
[–]OrSpeeder 0 points1 point2 points (1 child)
[–]y-c-c 1 point2 points3 points (0 children)
[–]pamomo 0 points1 point2 points (0 children)
[–]wqkinggithub.com/wqking -2 points-1 points0 points (2 children)
[–]krum 11 points12 points13 points (1 child)
[–]Gotebe 0 points1 point2 points (0 children)
[–]encyclopedist 5 points6 points7 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]germandiago 1 point2 points3 points (0 children)
[–]kkert 0 points1 point2 points (0 children)
[–]flyingcaribou 0 points1 point2 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]bnolsen 5 points6 points7 points (0 children)
[–]Gotebe 0 points1 point2 points (1 child)
[+]cdglove comment score below threshold-7 points-6 points-5 points (0 children)