vector

Java: Vector Definition

l_ABC_BEANVector = utilRemote.fnGetVector("ABC_COVBEANVector"); What is the coding means? Any help, i am truly appreciated it. Thanks ...

What is the purpose of the temporary Vector instance in this code?

Please explain this code to me; I don't understand why the additional vector TempC is needed: Vector A = new Vector(); Vector B = R.funcVector("TemporaryVector"); if(B!=null) { for(int i=0;i<B.size();i++) { Vector TempC = new Vector(); Vector D = new Vector(); TempC = (Vector)B.elementAt(i); if(...) { ...

Is the use of vectors of pointers here unnecessary or worse, cause memory leaks?

I am relatively new to C++ programming, but am a C programmer of 10 years so am more comfortable with pointers to objects than I am with references to objects. I'm writing a Solitaire game - is this design unsafe? Is there a better way? Anyway, I have a class SolitaireGame: class SolitaireGame: { public: SolitaireGame( in...

Finding uncommon elements across multiple vectors

I am attempting to find the elements that are not common across multiple vectors. That is, I want to know exactly the elements (not just their position, etc.) that are not shared across all vectors. The best implementation I could come up with uses a nested-loop, which I realize is probably the least efficient, most notably because the ...

How to use Vector in Flex?

I am trying to use the new Vector class introduced in Flash 10. Tried compiling the code using mxmlc but am getting this error message: Error: Type was not found or was not a compile-time constant: Vector. public var selectedRoutes:Vector.<Route>; ^ What could be the problem? What is the general consensus abou...

c++ vectors - Using find(begin, end, term)

Ok, i'm doing this and it works fine. end = std::find(arToken.begin() + nStart, arToken.end(), "."); I want to extend the . to include ! and ? so it finds periods(.), exclamation mark(!), and question mark(?). Should i use regex in the term? TIA ...

Delete all items from a c++ std::vector

I'm trying to delete everything from a std::vector by using the following code vector.erase( vector.begin(), vector.end() ); but it doesn't work, help! Update: Doesn't clear destruct the elements held by the vector? I don't want that, as I'm still using the objects, I just want to empty the container ...

Does std::vector.pop_back() change vector's capacity?

If I allocated an std::vector to a certain size and capacity using resize() and reserve() at the beginning of my program, is it possible that pop_back() may "break" the reserved capacity and cause reallocations? ...

combination of a two array ( vector )

Hi, I have v1 and v2 , how should I got a new v like below? v1 = {1,2} v2 = {3,4,5} v = {f(1,3) , f(1,4) , f(1,5) f(2,3) ,f(2,4) ,f(2,5)} I know I could do it using two loops, But If there is more idiomatic way like using STL algorithm? //using two loops for iter1 of v1 for iter2 of v2 v.push_back(f(v1,v2)) EDIT...

MATLAB Piecewise Functions + Vector Manipulation

I would like to write a program which plots the points on top of a semicircle on a certain interval and a straight line everywhere else. Something like this: __n__. I defined a time domain, which was stored as a vector (t = 0:0.01:5). I assumed that I could define the points on the top of the semicircle using elements of the time vector...

Help with error: ISO C++ forbids declaration of 'vector' with no type

As the title states, I'm not sure why I'm getting this error. I've put together a test.cpp that's similar to this structure, and it works fine. Also, other than the vector problem, there's the other problem about 'protected', which isn't even in the code. I think 'protected' is a macro, so no telling what's there. I'm new to QT, so I'm l...

In C++, how do I push an object to a vector while maintaining a pointer to the object?

In my code, I have a vector of Student objects. vector<Student> m_students; I want to: Check to see if the vector contains any Student of a certain name. If no such Student exists, add a new one. Add data to the Student of that name. Consider the following code: // Check to see if the Student already exists. Student* targetStuden...

vector <unsigned char> vs string for binary data

Which is a better c++ container for holding and accessing binary data? std::vector<unsigned char> or std::string Is one more efficient than the other? Is one a more 'correct' usage? ...

Is there a way to get the byte size of vectors through type alone?

How can I predict the size of a vector? #include <vector> #include <iostream> using namespace std; int main() { cout << sizeof(vector<char[8]>) << endl; cout << sizeof(vector<char[16]>) << endl; return 0; } [starlon@localhost LCDControl]$ ./test 12 12 ...

How to include dojox.gfx.SVG and dojox.gfx.VML in a custom Dojo build with cross-browser support?

Hello everyone. I am using dojo.gfx to create vector shapes and text on my website and everything works fine when I am "dojo.require"-ing all dependencies in my Javascript. But when I'm building everything I need in a custom build (especially dojox.gfx, dojox.gfx.svg and dojox.gfx.vml), Dojo's automatic differentiation for SVG-supportin...

How do i use perspective projection in this library

i found a library called pyeuclid and it seems to do what i want in respect to 3D math. it contins a 3D vector class and a 4X4 matrix class capable of transformations like rotate,translate and scale. matrix creation is simple, simply pass along the arguments and the matrix is created. >>> m = Matrix4() >>> m.translate(50,50,50) Matri...

C++ GCC 4.3.2 error on vector of char-array

Hello, It is similar in problem to this bug http://stackoverflow.com/questions/1468058/question-about-storing-array-in-a-stdvector-in-c but for a different reason (see below). For the following sample program in C++: #include <vector> int main(int c_, char ** v_) { const int LENGTH = 100; std::vector<char[LENGTH]>...

C++ Vector class as a member in other class

Please I have this code which gives me many errors: //Neuron.h File #ifndef Neuron_h #define Neuron_h #include "vector" class Neuron { private: vector<double>lstWeights; public: vector<double> GetWeight(); }; #endif //Neuron.cpp File #include "Neuron.h" vector<double> Neuron::GetWeight() { return lstWeights; } Could any one tell ...

Converting a C-string to a std::vector<byte> in an efficient way

I want to convert a C-style string into a byte-vector. A working solution would be converting each character manually and pushing it on the vector. However, I'm not satisfied with this solution and want to find a more elegant way. One of my attempts was the following: std::vector<byte> myVector; &myVector[0] = (byte)"MyString"; which...

Compiler warning with nested vectors of depth 3 or more

Hi, I am trying to use a class member that uses nested vectors of depth 3: vector< vector< vector > > classVariable_; However, I then get compiler warnings throughout my code when I try do something as simple as classVariable_.clear(): /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_vector.h: In member function `std::vector<_T...