vector Questions

4

Solved

I am working to implement a code which was written in MATLAB into C++. In MATLAB you can slice an Array with another array, like A(B), which results in a new array of the elements of A at the index...
Gessner asked 6/5, 2021 at 22:4

3

Solved

How to properly resize a vector of unique_ptr vectors in one line without gcc giving a compilation error regarding a deleted function? vector<vector<unique_ptr<A> >> a; a.resize(...
Manipular asked 27/11, 2015 at 8:27

4

Solved

I'm writing a ray tracer in java and I'm trying to implement refraction, but I'm getting confused by the information I'm finding on the subject. If I have a 3D vector for the incoming ray of light,...
Broddy asked 20/4, 2015 at 21:15

5

Solved

I simply wanna erase the specified element in the range-based loop: vector<int> vec = { 3, 4, 5, 6, 7, 8 }; for (auto & i:vec) { if (i>5) vec.erase(&i); } what's wrong?
Kristinkristina asked 9/7, 2015 at 23:4

1

Is there a way to extract the launcher icon of an apk file, even if it is an adaptive icon (vector drawable)? I couldn't find a single batch or python script to achieve this. There are many script...
Westberg asked 1/3, 2019 at 14:43

6

Solved

If I have the following vector {10 10 10 20 20 20 30 30} and I want a function to return the position of the integer that = X or directly the smaller element after X , like for example if I am sear...
Titos asked 15/11, 2012 at 14:11

2

Solved

I am implementing a small demo application which encrypts using AES CTR with OpenSSL is it possible to test the algorithm using different modes of operation test vectors for example testing the ECB...
Footy asked 6/7, 2010 at 16:57

3

Solved

How do I generate a vector of 100 64-bit integer values in the range from 1 to 20, allowing duplicates?
Heaver asked 12/1, 2018 at 1:51

6

Solved

how do you test whether a vector contains repetitive elements in R?
Clap asked 10/3, 2011 at 17:35

3

Solved

I have a class member that looks like this class Controller { protected: // other stuff std::vector<Task<event_t, stackDepth>> taskHandlers; //some more stuf } The Task class is ...
Fluviatile asked 6/7, 2020 at 7:49

4

Solved

Does it works correctly (does nothing) when I use vector<T> v; v.erase(v.end()); I want to use something like v.erase(std::find(...)); Should I if is it v.end() or not? There is no info ...
Paley asked 6/3, 2012 at 19:1

5

How to check if a template argument is a std::vector<T>::iterator? For void type, we have std::is_void. Is there something like that for std::vector<T>::iterator?
Kandacekandahar asked 9/11, 2016 at 17:7

23

I'm trying to ask the user to enter numbers that will be pushed into a vector, then using a function call to count these numbers. why is this not working? I'm only able to count the first number. t...
Domitian asked 4/12, 2011 at 18:43

7

Solved

In R, suppose I have a vector like: vector<-c("Red", " ", "", "5", "") I want to count how many elements of this vector are just empty strings ...
Phocomelia asked 30/6 at 19:21

7

In other words: how to check that all elements of one vector are present in another one, whereby the same element cannot be matched more than once. The question is very simple and yet, I could not ...
Giliane asked 4/6 at 9:17

3

Solved

I'm looking for a method that consumes a Vec and returns one element, without the overhead of restoring Vec's invariants the way remove and swap_remove do: fn take<T>(vec: Vec<T>, inde...
Functional asked 21/8, 2017 at 19:2

4

Solved

I have this: vector<Object*> myVec; and adding my objects to it like this: Object *obj1 = new Object; myVec.push_back(obj1); Let's assume that I have 100 objects in this way and pointer...
Purposeful asked 25/10, 2014 at 21:59

9

Solved

I have a problem that I would like to merge a large number of images using ImageMagick's convert.exe, but under Windows I have a 8192 byte long command line limit. My solution to this is to split...
Ummersen asked 28/7, 2011 at 14:57

2

Solved

In my code I have a std::unordered_set and I need to move the data into a std::vector. I'm using the std::unordered_set while getting the data to ensure only unique values are stored prior to conve...
Hewitt asked 28/2, 2017 at 22:24

14

Solved

I would like to copy the contents of a vector to one long string with a custom delimiter. So far, I've tried: // .h string getLabeledPointsString(const string delimiter=","); // .cpp string Gestur...
Whencesoever asked 14/2, 2012 at 13:42

5

Solved

As many of you know, there are quite a few websites that sell royalty free graphics. Some sites sell vector graphics (svg) or give you the option to download them as such. I don't have a graphics...
Estancia asked 19/5, 2011 at 20:11

3

Solved

I have a matrix: t = torch.rand(2,3) print(t) >>>tensor([[0.5164, 0.3651, 0.0882], [0.4488, 0.9824, 0.4067]]) I'm following this introduction to norms and want to try it in PyTorch. It s...
Ghiselin asked 22/7, 2021 at 18:17

3

Solved

I read an answer here showing how to read an entire stream into a std::string with the following one (two) liner: std::istreambuf_iterator<char> eos; std::string s(std::istreambuf_iterator&...
Mutt asked 27/10, 2014 at 14:3

3

Solved

I've this sample program of a step that I want to implement on my application. I want to push_back the int elements on the string separately, into a vector. How can I? #include <iostream> #...
Dormeuse asked 18/1, 2009 at 17:11

6

Solved

I have a vector that stores pointers to many objects instantiated dynamically, and I'm trying to iterate through the vector and remove certain elements (remove from vector and destroy object), but ...
Runyan asked 13/6, 2009 at 19:27

© 2022 - 2024 — McMap. All rights reserved.