hi – Im a c# developer looking to move into c for an embedded linux device I was planning to create a delegate

iterator iterator;

But I guess I’ll learn that later

you need to do some reading then!

that’s the most important use case for typedefs.

admitedly, I didn’t use templates really until 6 months or so into C++
but now they are indespensable

I almost never write what Codex_ wrote

i dont in cases like that

MyClassPtr

something like that is useful

I can’t wait for 0x template typedefs.

yeah, I don’t write that either, but maybe I should. Many do, I think

it makes code more ledgable i reckon, but you are hiding implementation details that can be handy to know about
obviously that could be any type of pointer and it wont be obvious to the reader without digging deeper

that iterator typedef is for situation when you dont want to give client apps knowledge of what container you use, but still want to provide a way to navigate through a container.

jkp, well, one could make it a convention that if it is anything else, that should either be self evident or commented, I don’t know

another alternative would be to build big classes (to get better abstraction), but normally it’s not needed.

yeah

true
i do do it in those cases
when you might want to swap the container say

actually those nested typedefs are mandatory for any generic programming approach
you receive a container (type T), how can you iterate over it?
by using an object of typename T

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Comments are closed.