Skip to main content
0 votes
0 answers
166 views

it -> a random valid vector iterator const int kLookAheadIndex -> a random number auto it_ahead = std::max(it - kLookAheadIndex, path.cbegin()); // get a look-ahead point to look at I know ...
Bill Kotsias's user avatar
  • 3,420
0 votes
1 answer
103 views

I am trying to populate a std::vector container using another std::vector and tbb::parallel_for method as shown in the following code snippet: #include <tbb/parallel_for.h> #include <eigen3/...
abhi.goudar's user avatar
2 votes
2 answers
194 views

Im wondering if there is a better, more typesafe, way to return "a selection" than I do at the moment. If we only ever have one selected element at a time, we can just return a reference, ...
darune's user avatar
  • 11.5k
3 votes
1 answer
252 views

System is: Ubuntu Linux 20.04.6 LTS g++ version 9.4.0 IDE QTCreator I have two vectors (set and subset), subset needs to be transferred into set, at location (0,0), such that, the rows are padded ...
Mike's user avatar
  • 629
4 votes
2 answers
185 views

I have the below code. The first push_back fails, the second, with a constant string, works. #include <vector> #define MAX_LENGTH 10 struct bar { int barInt; char barChar [...
Peter VARGA's user avatar
  • 5,327
1 vote
0 answers
57 views

What is the category of std::views::transform based on a std::vector? What is the category of the view's iterator in the following code? #include <iterator> #include <memory> #include <...
Krzysiek Karbowiak's user avatar
0 votes
1 answer
189 views

std::map<unsigned long, std::vector<Foo*> > fKeys = myObject->GetFoo(); for (auto it = fKeys.begin(); it != fKeys.end() && !found; ++it) for (auto it1 = 0; it1 < (*it)....
Igor's user avatar
  • 6,473
-2 votes
2 answers
260 views

I have a simple C++ program that manages as a todo list. The Todo, class contains a vector of Item to track each todo action and their id. The key constraint is that the ids must be kept strictly ...
0ro2's user avatar
  • 1,040
4 votes
2 answers
220 views

My problem is the following : std::vector<struct pollfd> vec = { ... }; // Actually a member variable on a Server object for (auto iter = vec.begin(); iter != vec.end(); ) { if (...
Azyrod's user avatar
  • 151
-3 votes
1 answer
238 views

I want to use auto more in my code and came up with the following example: #include <vector> int main() { auto v{std::vector{}}; for (auto i{0}; i < 10; i++) { v.push_back(i)...
Panic's user avatar
  • 93
3 votes
2 answers
111 views

This is my test code: #include<vector> #include<iostream> #include<type_traits> using std::vector; using std::is_same_v; using std::cout; using std::endl; int func() { struct ...
Vinod's user avatar
  • 1,215
7 votes
1 answer
250 views

The elements in the array are not default constructible therefore we need to initialize the array directly from elements in std::vector. #include <array> #include <vector> class foo { ...
 sentientbottleofwine's user avatar
3 votes
1 answer
174 views

In C++, what is the shortest way to declare a vector of vectors, where each inner std::vector's metadata fields (importantly size and pointer) have a user-chosen alignment? Ideally I'd be able to ...
nh2's user avatar
  • 26k
12 votes
1 answer
1k views

I defined a formatter for std::unique_ptr<T> in my code, but when I try to print a std::vector<std::unique_ptr<int>>, I am getting the following compiler error: std::...
Aakash Gupta's user avatar
0 votes
0 answers
74 views

This is a continuation of a previous discussion here... I'm trying to convert an existing GDI+ practice program to use for the various GDI+ objects... So the existing (working) code is this: ...
Gorlash's user avatar
  • 81

15 30 50 per page
1
2 3 4 5
207