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 » U++ Library support » U++ Core » Doubt with Buffer<> of a trivially destructible type
Re: Doubt with Buffer<> of a trivially destructible type [message #61252 is a reply to message #61251] Sun, 15 December 2024 14:29 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 656
Registered: March 2007
Contributor
The inablility for Vector to desctruct T[n] is a consequence of inherited inability for a function to return a c array.

For example
     T Vector::pop();


requires the housed type T be returnable.

There is no reason for c++ to systematically disallow it other than c says so, and there is liitle or no incentive for c++ to do otherwise, as it can be easily circled around.

We can have our Vector to work with T[n] if it's really really desirable, by encapuslating it in an intermediate struct Vector::ArrayWrapper automatically.
ArrayWrapper is contructible from, assignable from, convertible to the array type.

There is some work involved. And the requirement is less common to make it worthy.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to respond when memory is exceeded
Next Topic: Stream Load serialization fired twice
Goto Forum:
  


Current Time: Fri Jun 06 09:04:53 CEST 2025

Total time taken to generate the page: 0.04987 seconds