Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [c++]

C++ is a general-purpose programming language. Use this tag for questions about/utilizing C++. Do not also tag questions with [c] unless you have a good reason. C and C++ are different languages. Use a versioned tag such as [c++11], [c++20] etc. for questions specific to a standard revision.

0 votes
1 answer
65 views

How should I modify my code so that mouse-drawn lines remain on the canvas of the window during window scrolling

I am using win32 api to make a paint program, when I try to solve that using mouse to draw lines,remain the lines in the canvas, it can't work well. This is the Win Process Function: LRESULT ...
shiroha's user avatar
0 votes
1 answer
66 views

Lossy conversion between long double and double

I was cought by suprise that the following code returns false for gcc 13 and clang 18. Why does this happen? Isn't the number 8.1 representable in both formats? #include <iostream> #include <...
Martin Fehrs's user avatar
2 votes
1 answer
72 views

Order of c++ template arguments affecting compilation

I just encountered a new compilation error in my code after a visual studio update. I have stripped my code down to what I think is a minimal example. I have two templated functions both called pow - ...
Phil Rosenberg's user avatar
0 votes
2 answers
27 views

Strange results while trying to make matris symmetric in Eigen

In my project i work with covariance matrices and during many repetitive operation i have noticed that they gradually loose their symmetry. I put it down to numerical problems and when loss of ...
Budziwoj Man's user avatar
0 votes
2 answers
74 views

Why did std::sort use this simple strict weak ordering compare still crash? [duplicate]

Here is my code: #include<vector> #include<algorithm> #include<iostream> using namespace std; void test() { vector<vector<int>> info = {{0,0,999}, {0,1,1000}, {0,2,...
achimedzz's user avatar
0 votes
1 answer
33 views

Runtime error: addition of unsigned offset in leetcode

I was solving a question on Leetcode(322. Coin Change) and I wrote my solution which is working on VScode. the code is: int coinChange(vector<int>& coins, int amount) { int n = coins.size(...
Ankur Yadav's user avatar
2 votes
0 answers
42 views

Vulkan - VK_ERROR_INCOMPATIBLE_DRIVER error in Apple M2

With this code: #include <vulkan/vulkan.h> #include <iostream> #include <stdexcept> #include <cstdlib> #include <vector> class HelloTriangleApplication { public: ...
Caner - sagopanin sag kolu's user avatar
0 votes
0 answers
11 views

MPI failed to run on more than one host with OFI poll failed error

I am using MPICH 4.2.2 on Ubuntu 24.04 testing with the small program cpi that calculates the value of pi using MPI. I can start on host1 to run cpi on either host1 or host2 alone and I can start on ...
stackoverblown's user avatar
0 votes
0 answers
27 views

Extension of lifetime for inner fields when the type's lifetime is extended?

I am pondering about a piece of tooling code that we were using for a while here now, but which I suspect is actual undefined behaviour (at least, I got a couple of debugging sessions where it looks ...
Immanuel Scholz's user avatar
0 votes
0 answers
30 views

Issues with QGraphicsPixmapItem handling Mouse Events in QGraphicsScene

I created an object: class Button : public QObject, public QGraphicsPixmapItem { Q_OBJECT next I implemented a few functions: Button::Button() : m_pressed(false) { m_buttonPixmap = ...
Bondrusiek's user avatar
0 votes
0 answers
17 views

OpenMC Statepoints and Tally

OpenMC is a C++ open-source software for neutron transport calculations. openmc is an homonymous Python library that binds Python to OpenMC. I have no training to OpenMC and tried to figured out from ...
PackSciences's user avatar
0 votes
1 answer
14 views

QTableView not showing QPixmap

I'm trying to show a list of media files with Qt. For that I'm using a QTableView with a column for the preview and a column for the file name. With the following code, the file name is shown but the ...
TheEagle's user avatar
  • 5,914
6 votes
3 answers
278 views

Is it safe to move object inside its destructor

I'm 99% sure the answer to my question is 'Yes'. I just want to double check my assumption is right and I want to be sure that there is nothing in the upcoming C++ standards that could change the ...
Dmytro Ovdiienko's user avatar
0 votes
0 answers
23 views

How to custom cpp var value in gdb and clion > watches

see my img, I find zoned_time can show custom str "America/New_York" 1721904914882986761ns [2024-07-25 10:55:14] how to custom this value in my own class I try following code but it only ...
chikadance's user avatar
  • 4,025
0 votes
0 answers
32 views

Composing boost program options to get a multiline string

I am resuming C++ programming after 20 years by taking up C++ 20 standard and I try to read a multi-line configuration from an .ini file with boost's program_options. As .ini files do not support \r\n ...
mike's user avatar
  • 448

15 30 50 per page
1
4 5
6
7 8