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 #61223 is a reply to message #61220] Thu, 12 December 2024 14:40 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1210
Registered: August 2007
Senior Contributor
However, this should work too:

CONSOLE_APP_MAIN
{
	typedef std::array<double, 3> Vector3;

	Buffer<Vector3> vector3_data(10, {1.0, 2.0, 3.0});

	for(int i = 0; i < 10; i++) {
		auto a = vector3_data[i];
		Cout() << a[0] << " "<<  a[1] << " " << a[2] << "\r\n";
	}
	
}



Or, C++17 style:

	typedef std::array<double, 3> Vector3;

	Vector<Vector3> vector3_data(10, {1.0, 2.0, 3.0});

	for(auto& [a, b, c] : vector3_data) {
		Cout() << a << " "<<  b << " " << c << "\r\n";
	}
	



Best regards,
Oblivion


[Updated on: Thu, 12 December 2024 14:43]

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
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: Sat Jun 07 16:49:16 CEST 2025

Total time taken to generate the page: 0.04104 seconds