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 » Vector<Vector<double>> (Error in creating Vector<Vector<double>>)
Vector<Vector<double>> [message #49513] Thu, 22 February 2018 05:45 Go to previous message
Upp_User is currently offline  Upp_User
Messages: 8
Registered: May 2017
Location: India
Promising Member
Hello,
I wanted to create a square matrix using Vector<vector<double>>, However i am getting a error message during compilation.

I am using
Windows 10, Mingwx64,U++ 10804.

When i use 1D Vector (Vectors are 1D indeed Razz) i am getting the dynamic array initialization without any problem, but if i try 2D Array it seems not working.

Can i get some Help please!!!

Below is the code and the error message.

#include <Core/Core.h>
#include <iostream>
using namespace Upp;
using namespace std;

class Bezier
{
	public:
	Vector<Vector<double>> bezy;
	void getBez();
	void showBez();
};

CONSOLE_APP_MAIN
{
	Bezier myBez;
	myBez.getBez();
	myBez.showBez();
}

void Bezier::getBez()
{
	cout<<"generating the square matrix"<<endl;
	
	for(int i=0;i<5;i++)
	{
		for(int i=0;i<5;i++)
		{
			bezy.Add()=i;
		}
	}

	
}

void Bezier::showBez()
{
	StdLogSetup(LOG_COUT|LOG_FILE);
	cout<<"Display Square matrix"<<endl;
	DUMP(bezy);
}


Error Message during compiling:

D:\Migration\Myself\others\programming\upp\MyApps\Vector_2d\ Vector_2d.cpp (29): error: no match for 'operator=' (operand types are 'Upp::Vector<double>' and 'int')
(): bezy.Add()=i;
(): In file included from D:\Migration\Myself\others\programming\upp/uppsrc/Core/Core. h:269:0,
(): from D:\Migration\Myself\others\programming\upp\MyApps\Vector_2d\ Vector_2d.cpp:1:
D:\Migration\Myself\others\programming\upp/uppsrc/Core/Vcont .h (181): note: candidate: void Upp::Vector<T>::operator=(Upp::Vector<T>&&) [with T = double]
(): void operator=(Vector&& v) { if(this != &v) { Free(); Pick(pick(v)); } }
D:\Migration\Myself\others\programming\upp/uppsrc/Core/Vcont .h (181): note: no known conversion for argument 1 from 'int' to 'Upp::Vector<double>&&'



UPP User
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem with websocket connect method
Next Topic: How to close the websocket connection
Goto Forum:
  


Current Time: Tue Apr 16 11:36:58 CEST 2024

Total time taken to generate the page: 0.00804 seconds