U++ framework
Do not panic. Ask here before giving up.

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: 1266
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: Sun May 24 23:02:30 GMT+2 2026

Total time taken to generate the page: 0.00701 seconds