vector

eps image (from inkscape) not showing up in tcpdf

Using php and TCPDF to generate a pdf file. Everything works great except when I try to write an image to the pdf using ImageEPS(). Nothing shows up. No errors (it can definitely find the file). It just shows up as white space. Raster images (like PNG/JPG) work just fine. I'm using InkScape to save the .eps file. When I open the...

Declaring STL Data Structures such as Vector in the .h

I am trying to declare a private Data Structure such as the Vector in my C++ header file which I want to eventually use within the method implementation of my .cpp. An example would be my header "SomeClass.h" where I have: class SomeClass { private: Vector<T> myVector; public: void AddTtoMyVector(T add); } And in my .cpp whic...

Preferred way of filling up a C++ vector of structs

Alternative 1, reusing a temporary variable: Sticker sticker; sticker.x = x + foreground.x; sticker.y = foreground.y; sticker.width = foreground.width; sticker.height = foreground.height; board.push_back(sticker); sticker.x = x + outline.x; sticker.y = outline.y; sticker.width = outline.width; sticker.height = outline.height; board.pus...

Simple vector program error

Hi iam new to c++ and iam trying out this vector program and i am getting the following error: error: conversion from test*' to non-scalar typetest' requested| Here is the code #include <iostream> #include <fstream> #include <vector> #include <string> using namespace std; class test{ string s; vector <string> v; public: ...

Are the square brackets in Clojure's defn, defmacro and binding really a vector?

Are the square brackets around arguments in Clojure's defn, defmacro and binding (am I forgetting some?) really creating a vector or is it just a matter of syntax, making the arguments stand out from the rest? I'm reading Clojure in Action which states: Clojure uses vectors to denote function arguments or binding forms. which m...

android saveinstance saving vector datatypes

hi friends, I am making an application which is currently working perfectly but with only 1 problem... As we all know that the activity is destroyed and recreated when user changes the orientation of the phone... my activity needs to save a vector full of objects wen the activity is recreated... i checked the OnSaveInstance() method and ...

Converting a dataframe to a vector (by rows)

I have a dataframe with numeric entries like this one test <- data.frame(x=c(26,21,20),y=c(34,29,28)) How can I get the following vector? > 26,34,21,29,20,28 I was able to get it using the following, but I guess there should be a much more elegant way X <- test[1,] for (i in 2:dim(test)[1]){ X <- cbind(X,test[i,]) } ...

Vector Usage in MPI(C++)

I am new to MPI programming,stiil learning , i was successful till creating the Derived data-types by defining the structures . Now i want to include Vector in my structure and want to send the data across the Process. for ex: struct Structure{ //Constructor Structure(): X(nodes),mass(nodes),ac(nodes) { //code to calculate the mass ...

passing multiple vectors to function by reference (using structure)

Hi StackOverflow, Can someone tell me the correct way of passing multiple vectors to a function that can take only a single argument? (specifically for pthread_create (..) function) I tried the following but it does not seem to work :-( First, I created the following structure struct ip2 { void* obj; int dim; int n_s; ...

boost fusion: strange problem depending on number of elements on a vector

I am trying to use Boost::Fusion (Boost v1.42.0) in a personal project. I get an interesting error with this code: #include "boost/fusion/include/sequence.hpp" #include "boost/fusion/include/make_vector.hpp" #include "boost/fusion/include/insert.hpp" #include "boost/fusion/include/invoke_procedure.hpp" #include "boost/fusion/include/mak...

C++: Appending a vector to a vector

Assuming I have 2 STL vectors: vector<int> a; vector<int> b; Let's also say the both have around 30 elements. How do I add the vector b to the end of vector a? The dirty way would be iterating through b and adding each element via push_back, though I wouldn't like to do that! ...

Formatted input in c++

hey, i'm a noob to c++ (and coding in general) i'm looking for an easy way to take two doubles (at once) from the keyboard and store them in a struct i've created called "Point" and then ultimately store the Point into a vector of Points that's a member of a class (called "Polygon"). i know i could do it with a scanf but need to know how...

Can memory be leaked when using vector of pointer in c++?

I tried this: .... vector<players*> player; for (int i = 0; i<10; i++) { player.push_back(new players()); } ... And I wonder if I need to free memory for the vector? If so, how? ...

is there a way to condense a vector (C++)?

I have a sparsely populated vector that I populated via hashing, so elements are scattered randomly in the vector. Now what I want to do is iterate over every element in that vector. What I had in mind was essentially condensing the vector to fit the number of elements present, removing any empty spaces. Is there a way I can do this? ...

overloaded stream insertion operator with a vector

I'm trying to write an overloaded stream insertion operator for a class who's only member is a vector. It's a vector of Points, which is a struct containing two doubles. I figure what I want is to insert user input (a bunch of doubles) into a stream that I then send to a modifier method. I'm working off other stream insertion examples su...

Intersection of line with cube and knowing the point of intersection.

Hello everyone, description lines are originating from origin(0,0,0). lines are at some random angle to the Normal of Top face of the cube. if the lines are intersecting cube, calculate the intersection point. mainly I want to know how much distance the line traveled inside the cube. I don't know exactly which approach I should tak...

solving origin of a vectors

I have two endpoints (xa,ya) and (xb,yb) of two vectors, respectively a and b, originating from a same point (xo, yo). Also, I know that |a|=|b|+s, where s is a constant. I tried to compute the origin (xo, yo) but seem to fail at some point. How to solve this? ...

C++ STL vector iterator... but got runtime error

I'm studying STL and made win32 project.. But I got stuck in runtime error.. I tried to debug it but.. (partial code) vector<Vertex> currPoly=polygons.back(); vector<Vertex>::iterator it; for(it=currPoly.begin();it!=currPoly.end();++it){ vector<Vertex>::iterator p1; vector<Vertex>::iterator n1; vector<Vertex>::iterator ...

how to access child instances in a vector in c++

I have a parent class and child class (inherited from parent). In the child class, I have a member function named function_blah(); I used vector<parent*> A to store 5 parent instances, 3 child instances. So the total number of elements in the vector is 8. I can easily access to member functions of element A[0] to A[4], which are parent...

C++ STL Map vs Vector speed

In the interpreter for my experimental programming language I have a symbol table. Each symbol consists of a name and a value (the value can be e.g.: of type string, int, function, etc.). At first I represented the table with a vector and iterated through the symbols checking if the given symbol name fitted. Then I though using a map,...