Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Initialization for Buffer<T>
Re: Initialization for Buffer<T> [message #45221 is a reply to message #45217] Fri, 09 October 2015 17:34 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Actually, it is guaranteed.

typedef T *Iterator

Iterator type. Iterator is guaranteed to be of T* type.

operator T*()
Returns non-constant pointer to elements.


operator const T*() const
Returns constant pointer to elements.

I agree that more clearly worded guarantee should be given here (this is sort of implicit). Updating docs now...

Buffer indeed is replacement of situation

byte *buffer = new byte[N];
...
delete[] buffer;

but adding GetCount() would mean it is less efficient that this raw code. In the situation when you need GetCount, overhead of Vector is so small that you should perhaps use it instead (it only stores 'alloc' in addition to 'count').

[Updated on: Fri, 09 October 2015 17:38]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Solved] template.h errors when porting from 2010 source to 2012
Next Topic: How to fix this strong behaviore of MSC compiler & temporary value ?
Goto Forum:
  


Current Time: Tue May 07 07:33:10 CEST 2024

Total time taken to generate the page: 0.02751 seconds