Could this be true when some extra memory is needed for a dynamically allocated array and the re'allocation is not contiguous ?Quote:
This sounds wrong.
Printable View
Could this be true when some extra memory is needed for a dynamically allocated array and the re'allocation is not contiguous ?Quote:
This sounds wrong.
Considering that std::iterator_traits can be used as it is specialised for pointers, the lack of those typedefs do not mean that pointers are not "true" iterators.Quote:
Originally Posted by Elysia
What do you mean by "a dynamically allocated array"? Note that a std::vector's storage is contiguous.Quote:
Originally Posted by manasij7479
a normal one...like
or realloc'ing something earlier allocated with malloc ...Code:int *x = new int [10];
P.S:..my idea about the innards of memory allocation is poor at best ... :(
Allocation of memory in those cases will be contiguous.Quote:
Originally Posted by manasij7479
Then they should be rewritten to access typename std::iterator_traits<T>::some_type.Quote:
Originally Posted by Elysia
And to think I'm two weeks ahead of class and it's OVER in two weeks. All I got to do is the FINAL, so no more "is this HW", Never Again!
Anyway, I was about to start another thread but was afraid to ask "How-To"... than I read you guys new post, than I did a search and I found this link ... raw pointers and std::vector< std::vector< std::string > > ... Seems related and right up my alley anyway ... and they both works perfectly. I can't wait to get into bench-marking.
c++ - How to write the content of different files to a vector for further use with getline - Stack Overflow
This been my interest ever since you help me Ms. Elysia in my old vector thread and was what I needed to find to justify my reason to take a few semesters of C++ in the first place! Since than it been all about vector, It and Maps for me. I learn (pick-up) more from THIS thread than I learn all year. But school was cool.
I hope the OP can make use of this also, but it may not be nothing new to anyone but me.
btw: the forum was noticeable smoother since the new look but got very sluggish since the temporary shut down/clean-up a day or two ago ... I just notice that this only happens when I'm log-in. It's a rocket when I'm not.