2,295 reputation
513
bio website
location
age
visits member for 2 years, 4 months
seen 18 hours ago

1d
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
May
13
comment Should I prefer properties with or without private fields?
A tool like Fody can implement INotifyPropertyChanged without the need for explicit backing fields. github.com/Fody/PropertyChanged
May
7
answered Is JavaScript interpreted by design?
Apr
28
answered Fastest way to determine if a value is in a list?
Apr
28
comment How to migrate my thinking from C++ to C#
Many things done with macros in C++ can be done with reflection in C#.
Apr
28
comment How to migrate my thinking from C++ to C#
"One example of this that I have seen is that a lot of C++ developers will like to use for loops because they're faster than foreach." This is a bad idea in C++ too. Zero-cost abstraction is the great power of C++, and foreach or other algorithms shouldn't be slower than a hand-written for loop in most cases.
Apr
24
comment Is there a approximate string comparison function which is odd like mathematical functions are odd?
Well, you could use distance(a, b) = length(a) - length(b), which is very fuzzy and fulfills your requirement.
Apr
20
comment Receiving information from another application
I feel like attaching it to this answer makes it more likely to be read.