Correct way to work with vector of arrays

0 votes
Could someone please explain how to work with a vector of arrays correctly?

When I tried to resize a vector of arrays (vector<float[4]>), I received the error: conversion from 'int' to non-scalar type 'float [4]' requested.

What is the problem?
Aug 23 in C++ by Nicholas
• 6,240 points
19 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In C++

0 votes
0 answers

What is the easiest way to initialize a std::vector with hardcoded elements?

I can make an array and initialise&nb ...READ MORE

Jun 27 in C++ by Nicholas
• 6,240 points
45 views
0 votes
0 answers
0 votes
1 answer

How do i apply lower_bound to a range of unsorted vector elements?

What's the point of sorting your array? ...READ MORE

answered Jun 15 in C++ by Damon
• 4,960 points
153 views
0 votes
1 answer

Vector of Vectors to create matrix

Before accessing any elements, you must first set the vector of vectors to the right size.  You may do it this way: // assumes using std::vector for brevity vector<vector<int>> matrix(RR, ...READ MORE

answered Jun 16 in C++ by Damon
• 4,960 points
67 views
0 votes
0 answers

How to use vector::push_back()` with a struct?

How do I push a struct back into a vector? struct point { int ...READ MORE

Jul 22 in C++ by Nicholas
• 6,240 points
118 views
0 votes
0 answers

Adding to a vector of pair

I have a pair vector that looks like this: vector<pair<string,double>> revenue; I'd want to add a string and a double from a map that looks like this: revenue[i].first = "string"; revenue[i].second = map[i].second; However, because revenue is not initialised, it returns an out of bounds error.  So I ...READ MORE

Jul 26 in C++ by Nicholas
• 6,240 points
86 views
0 votes
0 answers

How do I determine the size of my array in C?

How do I determine the size of ...READ MORE

May 1 in Others by Kichu
• 19,040 points
33 views
0 votes
1 answer

How to find out if an item is present in an std::vector?

The most straightforward solution is to count the total number of elements in the vector that have the specified value.  If the count is greater than zero, we've found our element.  This is simple to accomplish with the std::count function. #include <iostream> #include <vector> #include <algorithm> int main() { ...READ MORE

answered May 27 in Others by Damon
• 4,960 points
49 views
0 votes
0 answers

How to implement 2D vector array?

I'm using the vector class in the ...READ MORE

Jun 1 in C++ by Nicholas
• 6,240 points
32 views
0 votes
0 answers

How to implement 2D vector array?

I'm using the vector class in the ...READ MORE

Jun 1 in C++ by Nicholas
• 6,240 points
15 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP