1,100 reputation
812
bio website
location Netherlands
age 42
visits member for 4 years, 3 months
seen 4 hours ago

2d
comment What approach to develop a bot player for the Trax game?
-1 for asking to download an executable and run it.
2d
comment What approach to develop a bot player for the Trax game?
I think that gamedev.stackexchange.com is a better fit for this question.
Apr
3
awarded  Pundit
Mar
19
comment Optional Member Data
The advantages of this hasFavoriteColor() is that it allows the getFavoriteColor() to return a reference instead of a pointer - by adding a precondition that the caller is responsible to check hasFavoriteColor() before calling getFavoriteColor() - while backing storage isn't duplicated. (of course, a decent implementation of getFavoriteColor() will include an assert to check this precondition).
Mar
19
comment Optional Member Data
There is a difference between 'empty' and 'not present'. Second, if it's a more complicated class, there might be no 'empty' representation.
Mar
19
comment Optional Member Data
Small point: "You may setFavoriteColor( "Blue" ) then be surprised when your XML output doesn't show Blue because you forgot to setHasFavoriteColor( true )." Solution: add a mHasFavoriteColor = true; in the setFavoriteColor() function. The advantage of setters over direct member access is that functions can maintain class invariants.
Feb
20
comment Typedefs to convey relations between classes
While I agree with your approach and the answers, I would suggest to use just Index. In practice - as demonstrated by your code - you'll have to prefix it with the class name anyway: ModelNode::Index, AABB::Index ...
Jan
30
comment Tips for understanding big project fast?
Visual Studio has a "show definition" functionality. Try right-clicking on the name and look at the pop-up menu. I've witnessed problems with it, but it usually is better than using ctrl-F.
Jan
25
answered What is the point of making a syntactic distinction between standard and user-defined types?
Jan
20
awarded  Nice Answer
Jan
15
awarded  Nice Answer
Jan
11
comment How to structure a loop that repeats until success and handles failures
This is the logical next step after the rewrites in my answer.
Jan
11
comment How to structure a loop that repeats until success and handles failures
@DocBrown The duplication of the cout is mostly an artifact of the example. In practice, the two cout statements will be different as the second will contain an error message. E.g. "Please enter <foo>:" and "Error! Please re-enter <foo>:".
Jan
10
awarded  Yearling
Jan
8
answered How to structure a loop that repeats until success and handles failures
Nov
9
comment What's wrong with statically linking the STL into multiple shared libraries?
@KonradRudolph Among others, (N)RVO optimalisations create situations where the returned string is constructed by libA.so while destructed by libB.so.
Aug
29
comment Best practice for unused inherited virtual functions (implementing superclass methods)
You can insert an using Base::foo1; in class A, after which A::foo1(1); will work.
Jul
9
comment Value of passing by reference
"Why have both?" Because there are differences between the two, and C++ lets you decide which one fits your situation best. See the link for the differences.
Jul
7
comment How to solve linear recurrences involving two functions?
Usually the next step is a Eigen-value/Eigen-vector decomposition of the matrix, after which an explicit formula for F(n) and G(n) can be derived.
Jul
2
comment What does “ (int) value & 0x1, (int) value & 0x2, (int) value & 0x4, (int) value & 0x8 means”
The wording may suggest that it can be extended to all numbers, which is not true: 8/6 is odd, while 8&6 yields false.