General C++ Programming - October 2022

LRU Cache Simulation Heap Overflow Problem
 
Hi, I'm new to C and are working on LRU Cache Simulation recently. However, when testing testcase w/ very large amount of data, it shows up that heap-buffer ove...
[6 replies] Last: And if there's anything that I can improve, maybe the coding style? A... (by kbw)
by t im
about address of std::vector<std::vector<int>>
 
Please frist read the code below: vector<vector<int>> v({ { 1 }, { 2 } }); v .push_back(3); v .push_back(4); After initialization, the size of v and ...
[5 replies] Last: Thanks for all your answers that help me figure it out! (by t im)
by t im
resize() and reserve() of std::vector
 
In most cases, resize() changes the size of a vector while reserve() changes capacity of a vector. My question is about reserve() function. First look at the co...
[7 replies] Last: Thanks for all your helpful reply. I get it. (by t im)
Tree (traversal)
 
Please help what is wrong with my codes? I created Tree.cpp. main.cpp and Node.h, Tree.h. It gives me an error. //Tree.cpp #include "Tree.h" Tree::T...
[1 reply] : At a cursory glance, Tree.h needs to declare the type Node . #ifnde... (by JLBorges)
by Cplusc
OpenMP for nested loops
 
I am writing a lattice boltzmann solver and to do so I'm using OpenMP for loop parallelization. After using OpenMp not only the execution time is not reduced bu...
[9 replies] Last: @salem c the code is easy to read. I almost used <= everywhere Expect ... (by Cplusc)
Cannot convert argument from 'variable' to 'const T &'
 
Howdy. I am using a doubly linked list to obtain requests from an input file and eventually place them into an array of queues based on priority. When reading i...
[8 replies] Last: As a starter code that compiles, consider: #include <iostream> #inc... (by seeplus)
by Cplusc
Animation
 
I'm doing a fluid simulation and for post processing I'm using paraview. For this, I need to reaload the vtk or csv file whenever i want to see the plot during ...
[1 reply] : Paraview is a completely separate application. I'm not sure that it wo... (by lastchance)
Boost Python: "Mixing a dll boost library with a static runtime is a really bad idea..."
 
I am currently trying to create a python binding for a large C++ library. After some searching, I have decided to use boost/python. I am running into a compi...
[1 reply] : Current code: #define BOOST_PYTHON_DYNAMIC_LIB #include <exception>... (by Mathhead200)
Accessing private member declared in header
 
Howdy. I have a doubly linked list class that I was given the function names for. One of them is called CopyAll which should copy all the nodes from the input d...
[2 replies] Last: Many thanks. I didn't check the provided members well enough before I ... (by malibuwiley)
Please explain what this code does
 
Hello all , All i know , This is a Buffer for thiscall Function struct sAABuffer_Helper { DWORD SecondDword; BYTE Filler ; }; struct sAABuffer { ...
[no replies]
C++20 Modules as interfaces
 
Hey guys, I'd like to use C++20 concepts to define interfaces. Usually I'd define interfaces using virtual functions but in this particular case I do not want ...
[6 replies] Last: cool thank your very much. I'm getting a better understanding of conce... (by JuliusCaesar)
how to convert message digest to bigInteger in c++
 
For example say I have a message digest "cf91cc61b74a1feda9902ae9b9e96d9a" using md5() How do I convert this message digest to a bigInteger so that I can u...
[9 replies] Last: You do not need to compile Boost Libraries to use the Boost cpp_int ... (by Duthomhas)
smart pointer issue with file
 
Hi I am facing a problem while trying to create file manager using smart pointers. Which option (unique_ptr, shared_ptr, auto_ptr, weak_ptr) is more optimal h...
[5 replies] Last: Maybe I am just slow today, but I hope you understand this, and maybe ... (by jonnin)
Error on multi-D dynamic array output
 
How solve the error on multi-D dynamic array read to be output below? #include <iostream> #include <vector> using namespace std; vector<vector<char>> l; l ....
[3 replies] Last: #include <iostream> #include <vector> using namespace std; int main(... (by lastchance)
data struct selection
 
Which data structure is more ideal here? 1)Frequently need to add and remove elements from the middle of a list, and you will not read it very frequently? I tri...
[10 replies] Last: Thanks everyone for your inputs. This thread can be closed. (by leo2008)
does vector <int> myVec [5] creates 5 vector?
 
and list<int> myList creates 10 linked list? the and () seems to be very different.
[6 replies] Last: std::vector<int> myVec creates a C-style array with 5 elements, eac... (by deleted account xyzzy)
How does vector initialize and allocate in one line?
 
How, as vector<int> n(9) is allocating, can vector initialize and allocate in one line (as giving error in this e.g.) ? #include <vector> using namespace std;...
[3 replies] Last: Note that the number that you pass to the constructor (inside the pare... (by Peter87)
Linker 2019 error unresolved external symbol
 
I am pretty sure I have something wrong with how I am using my templates like syntax. I am making a program that works with an array-based Queue. I might have h...
[8 replies] Last: Including a .cpp into my header (I know I should not do this now) I t... (by Ganado)
by Cplusc
how initialize an object of a class which is defined within a name space
 
I am trying to initialize the ex and ey variables in the following piece of code but unfortunately I keep getting linker error. thanks in advance. namespace L...
[10 replies] Last: Well, strictly you could use MPI_Allreduce, but I take your point. (by lastchance)
Object oriented programming menu troubles
 
Hello all, i am in a programming 2 class and thought i was understanding quite well, but i am getting stuck with this project my professor assigned. I believe i...
[6 replies] Last: If you post a file data sample, we can provide advice as to how best r... (by seeplus)
October 2022 Pages: 123
  Archived months: [sep2022] [nov2022]

This is an archived page. To post a new message, go to the current page.