|
I'm having some trouble getting standard iterators to work, and google isn't giving me much help. Currently I have something like this: code:
When I compile (using VS2008) I get an error saying: code:
Is there another class I should be deriving from or different template arguments I should be providing to std::iterator? The only requirements I have for the iterator are that it can advance forward and check for equality with other iterators (as well as access whatever it points to, obviously). I've noticed that the functions in the <algorithms> header just use templates that take any old class as an iterator, leaving it up to the user to make sure it supplies the proper operations. I would assume that is because they need to support pointers as well as actual iterator classes. Even though I don't need the support for pointers, would this be a better approach for my problem? I've been avoiding it so far because I want to make this as standardized as possible, plus I don't know the syntax for a member function with additional template parameters from its class. Can I just use nested templates?
|
# ¿ Mar 23, 2008 20:54 |
|
|
# ¿ May 3, 2024 21:16 |
|
floWenoL posted:What do you guys think of this? Personally I think this is disgusting: code:
The indentation also bothers me. I would much rather have lines move to the right the farther I read into the function, rather than the weird shifting going on here. I also don't like the bit on function naming. It seems like it could introduce inconsistencies if there isn't a direct relationship between public characteristics and internal implementation variables. Edit: I'd be interested in hearing what the rest of you think about the section on streams in particular. Not just for Google's case (where they need to maintain consistency with old code) but for general practice programming. The guide seems to dismiss the issue as "they both have pros and cons, so either one is just as good." Dransparency fucked around with this message at 04:35 on Jun 30, 2008 |
# ¿ Jun 30, 2008 04:28 |
|
That Turkey Story posted:Edit: I don't know why you're getting all upset about naming and indentation, etc. You can't really fault anyone for something that's nearly entirely a subjective choice. Well, he asked for our opinions, so I gave mine. I really do think having a different naming scheme for functions that deal with member variables is bad, since it ties interface to implementation.
|
# ¿ Jun 30, 2008 18:02 |
|
Nutsack Rangoon posted:Let me preface by saying I'm terrible: You've mistyped "<=" as "=<".
|
# ¿ Jan 30, 2011 03:32 |