I makes games and stuff.

Jul
26
awarded Yearling
Jul
26
awarded Yearling
Jul
9
comment OpenGL: How should 2D quads be stored/rendered?
Why do you feel that using a VBO for each quad is "overkill"? You've got to get the data to the GPU somehow, and there really isn't any other way to do it. If it ends up being too slow, you'll have to switch to some other method, such as point sprites.
Jul
7
revised The meaning of synonym in typedef
added 180 characters in body
Jul
7
answered The meaning of synonym in typedef
Jul
7
comment The meaning of synonym in typedef
@Hector i1 is a synonym for the type that is long int. It is not a synonym for the keyword long. Otherwise you could also say i1 double and get a long double.
Jul
7
comment The meaning of synonym in typedef
@Hector I don't believe that's how that section is supposed to be interpreted. The phrase, "syntactically equivalent to a keyword," just means that the typedef-name can be used in the same way that a keyword can. Assuming that i1 can be used in place of long simply because they both act like keywords is a bit of a stretch.
Jul
7
comment The meaning of synonym in typedef
@Hector In your example, i1 is not syntactically equivalent to long. It is a synonym, but not a macro.
Jun
30
comment std::vector - optimization during game loop
@nilo Are you sure this is the answer you want? This requires an extra (potentially large) allocation during each call to do_update_and_render, which can cause memory fragmentation and other performance issues.
Jun
30
comment std::vector - optimization during game loop
@nilo Performance is mostly irrelevant here. Do the thing that is easiest and leads to the cleanest code. I'd vote for erasing it all at once using remove_if.
Jun
30
comment C++ variadic template, recursion decltype
@ltb68167 It is possible if you have access to C++14 auto deduced return types (different from C++11 trailing return types). But it is much easier and cleaner to use structs.
Jun
30
comment Which operator is used first?
+1 for correct answer, but note: x++ will always be evaluated before the <. However, it is the side-effects of the x++ that may happen before or after the <. Basically, it's tmp=eval(x); return eval(tmp<10); with a ++x; at some random point.
Jun
29
comment C++ SQL wrapper/Connection
No enough to make an answer, but you might want to use std::make_unique<T>(...) rather than std::unique_ptr<ConnectionProxy>(new T(...)). A bit cleaner and safer.
Jun
29
awarded Caucus
Jun
29
comment linear distribution in c++ using rand()
Can you use C++11 or above? There's a nice <random> header that provides much better random number facilities than rand.
Jun
29
comment C++ abstract or interface classes?
C++ has no concept of an "interface" type. The closest thing is an abstract base class.
Jun
26
comment Manipulating bitset in C++
@adrian008 http://ideone.com/0PdY3B
Jun
26
comment Manipulating bitset in C++
@adrian008 That code works for me. Also, there's no need to use .to_string() all the time. You can use cout<< on a bitset directly.
Jun
26
comment Manipulating bitset in C++
@adrian008 Well, regardless, you can't use the for (auto& x : b) { ... } syntax with bitset, but for (auto i=0u; i<b.size(); ++i) { auto x = b[i]; ... } should work.
Jun
26
comment Manipulating bitset in C++
It may be worth mentioning that 1 & x is equivalent to the identity function, because (1 & x) == x, so this code wouldn't modify the values even if it were correct.
1 2 3 4 5