User Profile
Collapse
-
Thanks, it works with the default constructor :) -
This worked fine until I added variables to the struct. The erro is as follows:
main.cpp:46: error: no matching function for call to ‘VEdge::VEdge() ’
VEdge.h:6: note: candidates are: VEdge::VEdge(in t, int, bool)
VEdge.h:1: note: VEdge::VEdge(co nst VEdge&)
I think it wants a constructor call of some sort...Leave a comment:
-
dynamic allocation
Hi
I am trying to create matrix of a struct I defined. It seems i cannot just sub in my struct name for float:
What can I do instead?Code:float **matrix; int rows = 10, cols = 10; matrix = new float* [rows]; for(int i = 0; i<rows; i++) { matrix [i] = new float [cols]; } -
-
creating an iterator
Hi All
I am trying to implement a hash table using separate chaining. I have declared a vector of list [vector< list<string> > myList]. I am now trying to create a makeEmpty( ) method. But I am having trouble wih creating an iterator for the list embedded in the vector.
Cna anyone help me out?
Thanks -
sorting vector continued.....
I am trying to sort a vector containing objects of a class, using one of the instance variables as a key(int).
I defined the operator overload as follows:
In the driver i have included <algorithm> and am using the sort method as follows:Code:bool info::operator < (info &b){ return getWeight() < b.getWeight(); }
...Leave a comment:
-
sorting vector
Hi All
I posted earlier.....
I took advise on using the sort method in the STL under algorithms on a class that I created. Here is the operator overloading that i did but i cant seem to get it to sort at all. PLease help
Code:bool info::operator < (info &b){ if ( (*this).getWeight() < b.getWeight() ) return true; else return false; }Leave a comment:
-
sorting a vector
Hi All
I was just wondering if its possible to use the sort method found in the STL algorithms class on a vector I declared as: " vector<myClass> myVector; "
where I want to sort according to one of the instance varaibles of myClass.
Thanks
No activity results to display
Show More
Leave a comment: