Return - Entire thread - Last 10 posts

Brainfart: GCC and templates (11)

1 Name: #!/usr/bin/anonymous : 2006-10-25 16:04 ID:yRl1iPbl

Trying to get back into C++ after only using python for almost a year. I ran into this one while trying out partial template specialization, narrowed it down to this simple test case...

#include <iostream>
Entire post...

2 Name: #!/usr/bin/anonymous : 2006-10-25 21:01 ID:WQDDjra2

structs can have functions?

3 Name: #!/usr/bin/anonymous : 2006-10-25 21:55 ID:cRCqb5aI

Yes. In C++, the only difference between a struct and a function is that a struct's members are public by default, if I recall right.

4 Name: #!/usr/bin/anonymous : 2006-10-26 07:45 ID:GufioEP4

...ugh, should've googled more first. Apparently it's two-phase name lookup that makes it barf.

Templates and accessing inherited members

Entire post...

5 Name: #!/usr/bin/anonymous : 2006-10-29 08:39 ID:cMRxjRN8

Isn't partial specialization the sort of thing that you should only whip out if your execution time and/or cache profilers tell you that yeah, maybe using a 32-bit integer for a boolean value wasn't that smart after all?

6 Name: #!/usr/bin/anonymous : 2006-10-29 08:55 ID:cMRxjRN8

Plus, structs have different alignment rules. I seem to recall that classes' members may be even reordered to get better packing in the presence of alignment constraints, whereas structs need to appear in memory as they are declared.

Entire post...

7 Name: #!/usr/bin/anonymous : 2006-11-10 00:40 ID:6aGbySab


>>Plus, structs have different alignment rules. I seem to recall that classes' members may be even reordered
Entire post...

8 Name: #!/usr/bin/anonymous : 2006-11-10 05:01 ID:yRl1iPbl

don't sweat it, your code is fine. heck, if you define operator float* in your vector class, you can ditch the explicit typecast for every function call, too.
9.2.12 Nonstatic data members of a (non-union) class declared without an intervening access-specifier are allocated so that
Entire post...

9 Name: #!/usr/bin/anonymous : 2006-11-10 07:33 ID:6aGbySab


I thought operator overloading could only overload... operators. Can you really overload typecasts as if they're operators? I've never heard or seen that. If it's true, then I've said it before and I've said it again -- it's pretty much guaranteed I learn something new about C++ every week, for almost like 7 years now. Just last year I found out C++ has try/catch/throw style exceptions... I don't use them (I can only take so much visual clutter), but they're there if I want to.

Entire post...

10 Name: #!/usr/bin/anonymous : 2006-11-11 08:09 ID:yRl1iPbl

Heh, yeah, C++ always has some new stuff, especially the obscure template magic you only tend to see in things like boost.
I have this in my vector class:

Entire post...

11 Name: #!/usr/bin/anonymous : 2017-03-13 21:42 ID:X+RmD5B1

dicks out for Harambe