Reputation
2,310
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
5 13
Impact
~50k people reached

  • 0 posts edited
  • 1 helpful flag
  • 61 votes cast
Aug
13
comment C++11 Lambda vs Helper Member Functions
Define acceptable. It's very unusual as an idiom (so far), and I would consider it quite surprising if someone in my team did that. Is that a reason for it to not be acceptable?
Jul
24
comment How do I handle setters on immutable fields?
@DanLyons Damn, I was looking forward to using this throughout our codebase.
Jul
23
comment How do I handle setters on immutable fields?
And primary constructors can simplify this even further, by getting rid of the syntactic overhead of the constructor.
Jul
15
comment Const C++ DRY Strategies
A getter that just returns a member is shorter than one that casts and calls the other version of itself. The trick is meant for more complicated functions where the gain of deduplication outweighs the risks of casting.
Jun
25
comment Flag arguments in an html factory class
Or a small special-purpose enum that only has optionalField and requiredField values.
Jun
23
comment How safe is it to compile a piece of source code from a random stranger?
There are online Java compilers that are completely sandboxed. Just use one of these and your machine is not at risk.
Jun
8
comment Why there is no power operator in Java / C++?
@CodesInChaos -> is not a binary operator for the purpose of overloading.
May
28
comment Multiple if in comparison function vs chain of || or &&
Use the second, and see if you can't get rid of the more complex conditions by wrapping the relevant data in a separate class that itself overloads ==
May
21
comment Is it possible to refactor inheritance to composition when virtual methods are called inside the base class?
It sounds like your design has hopelessly entangled game logic (Country) with interaction (Player and AI). You probably need an event/callback system to disentangle the two.
May
21
answered Blocking function call with asynchronous content
May
21
answered What is the functional programming answer to type-based invariants?
May
20
comment Does a Completely Full-Featured Intermediate Language Exist?
@SamWashburn You'd have to have a language with every feature from every language, or at least features so powerful that they can represent every feature, along with annotations containing hint about what the original looked like. Such a language would be completely unusable for humans because of the learning curve involved, and the compiler would be incredibly massive. My solution is much easier to implement, even though it wasn't meant quite seriously.
May
17
answered Does a Completely Full-Featured Intermediate Language Exist?
May
15
comment Should I set values using the return or by giving a reference?
"I don't like unnecessarily including memory management if I can help it" - If returning a MousePosition by value involves any memory management on the side of its user, the class insufficiently encapsulated.
May
15
comment Should a comparison method ever return the same type back as it's comparing?
I already have a bad feeling about this course.
May
14
comment Should a comparison method ever return the same type back as it's comparing?
@Carcigenicate My guess is typo in the requirements, so once you are able to, you should contact them and ask for clarification.
May
14
comment Which code is better for branch prediction optimization?
Remember that just because you write the branch one way, doesn't mean the compiler won't flip it around in the actual code layout.
May
14
answered Should a comparison method ever return the same type back as it's comparing?
May
14
comment A little confused with virtual functions
Your example doesn't have any son objects anyway.
May
13
answered C++: Make classes immutable or compatible with STL containers