Category "vector"

How to reserve memory space for std::vector in terms of bytes?

I am trying to write up a config parser class in c++. I'll first give a snippet of my class: class foo{ private: struct st{ std::vector<pair<s

Convert string into binary vector in R

I'm trying to clusterize a set of journals by descriptors and I've been thinking of turning descriptors into a binary vector instead of using string distances (

Deleting a pointer from a vector... Error: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

I'm getting the error after I delete a pointer from the vector and try to delete a second one. I'm still new to pointers I created a base class of shapes and ha

C++ Vector returning odd output for last iteration?

I am attempting to figure out the Skyline problem to better understand C++, right now I am learning more about how I can use vectors. I am trying to iterate thr

How to store every sequentially increasing sequence in a vector into new vectors

I have a vector with the following elements: std::vector<int> vectorOfInts{ 95, 137, 138, 139, 140, 156, 157, 158, 159 }; Problem: I'm trying to store eac

How to test a real ECU via CANoe

I am new with CANoe, and now I am trying to test a real ECU by sending diagnostic requests to it and get response from the ECU via CANoe. I use VN5610A and CANo

Arduino - need reassign Timer 0 overflow (TIMER0_OVF_vect) to different ISR - how?

On a generic Arduino (ATMEGA386P) -based application, I need Timer 0's overflow interrupt (normally goes to TIMER0_OVF_vect) to point to my own code, not the ex

Figma SVG not parsing with flutter_svg

I have created a bunch of vector graphics I want to use inside my flutter application but cannot seem to load any SVGs from Figma using flutter_svg. This is the

Unity: Convert Vector2 to Vector2Int

I have a Vector2 and I want to convert it into a Vector2Int. I know I could convert the Vector2 with something like this: Vector2 v2 = new Vector2(10, 10); Vec

Is there multiple ways to cin vector elements?

I have a program that adds multiple vectors in 1 vector. I saw a method of instead of .push_back to add elements and I used it, but I am wondering why this work

Updating an intrinsic rotation with an extrinsic rotation

I am trying to model a Rubik's Cube for a personal project, using Zdog for lightweight 3d graphics. Zdog uses a {x,y,z} vector to represent rotation - I believe

How to plot wind vectors on wind map

I have NAM wind models that I create map from but I am struggling to add average wind direction vectors. How do I convert the U and V vectors so they give avera

Virtual Method not calling derived class method (only calling base class) C++

My base class detect() and collect() methods are the only ones being called. I'm trying to get the derived class methods of these to be printed instead. I belie

Handling custom vector classes

I have come across many occasions where I want to have an item which is selected inside a vector, for this I have written the template class: // a vector wrappe

C++: What is the correct cast for offseting to std::vector iterator?

I have a function that takes a std::vector of doubles, and copies them to another vector, but at a particular offset (assume there is sufficient space): void c

Keep getting error message not all control paths return a value

bool isEnemy(const string& check) { if (check == enemy1 || check == enemy2 || check == enemy3) // if the name being checked is an enemy of this kni

How to implement outer product of two vectors in Scheme?

I want to define a function in Scheme that will compute the outer product of two vectors. for example: (outerProduct '(1 2 3) '(4 5)) the output is supposed to

Cache-friendliness std::list vs std::vector

With CPU caches becoming better and better std::vector usually outperforms std::list even when it comes to testing the strengths of a std::list. For this reason

GeoDataFrame is Inverted when I converted from Raster to Vector using RasterIO

I'm currently using this code to convert a raster file to a geodataframe: import rasterio from rasterio.features import shapes mask = None with rasterio.open

Fail to insert the element of the set to the vector in c++

Given a set of integers: set<int> setA = {1,2,3,4,5}; Now I want to insert the integer to a vector of integers under a certain condition: vector<int&g