- I could only see this as iterating the list, increasing and decreasing an internal iterator!
Makes no effective logic to set a list as one item, but if you make it a += its a perfectly acceptable "Append"
makes no sense to me, if its a template, the any object won't have a common logic evaluation. Therefore, what the hell wold be a negation of a list of any kind of object? Cant think of anything
Hope it helps
Yes it does, thank you for your feedback.
If you have to ask the question "what should this operator do or return", then you shouldn't be making that operator. It defeats the point and makes your code more confusing.
I have in mind precisely what it would do, but generally in programming, bugs occur when the assumptions of the user (IE other than me) are different from the assumptions of the program. In this case I want to see if other people instinctively have the same concepts I do before I make it part of the design.
Any reason why you don't want to just use std::list?
Std::list requires log(n) time to get the size of the list, when it's perfectly possible to get a log(1) return, including iterator numeric position. Given how I have no idea how it operates under the covers (if it does log(n) for size returns, what else does it do inefficiently?), it makes it difficult for me to optimise it to other classes - which are supposed to automate, simplify and make safe tasks.
The size issue might not seem like a gripe at first but running log(n)*n for how many times size is required seems very poor (especially given this will be for dynamic char lists of sizes 89000+ or more from files). Custom-lists also gain the advantage of improving over iteration (IE design and improvement), fewer functions, more capability/stability.
TemplateList++;
TemplateList--;
--TemplateList;
++TemplateList;
TemplateList = Item;
(!TemplateList)
- push back a default-constructed item
- pop back
- pop front
- push front a default-constructed item
- no idea
- test if the list is empty
These are generally the ideas I had for the list. Iteration across the list was the other alternative, but it would make either pre or post-fix redundant (duplication of tasks).
In my opinion, it's confusing at best. Follow the rules of the language and its standard library. Don't try to over-simplify, longer but more explicit names will always be more intuitive than operators. Use operators only when they make perfect sense. And... use standard classes, don't reinvent the wheel
The operators would be front-ends for suitably named functions, with the named functions themselves still accessible. As for std library functions, they tend not to be my preference, generally because of how they work.
But it's good, thank you for the feedback. I will consider it when writing the classes. Any additional feedback is appreciated.