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.
404
questions
1
vote
0
answers
6
views
Inaccurate compile-time computation of Fibonacci sequence in a recursive lambda
Below is a recursive lambda expression that can compute the values of Fibonacci sequence both in runtime and during constant evaluation:
auto fib = [](this auto && f, auto && p) {
...
-2
votes
0
answers
16
views
How can instancing make this so much slower? [closed]
I'm drawing many copies of the same model. I can draw them by pushing a different uniform matrix for each one, or I can push a buffer full of matrices once and draw them with instancing. Why would the ...
0
votes
0
answers
33
views
Does a deque maintain its capacity even if emptied completely?
I wanted to test if a deque<> does free its chunks if it is completely emptied:
#include <iostream>
#include <deque>
using namespace std;
uint64_t nAllocs = 0, nFrees = 0;
void *...
-1
votes
0
answers
34
views
Everyone else's terminal looks nice and clean when they run C++ code like this, but mine has this whenever I run it, did I install something wrong?
The simple code that I ran
I tried running, debugging, rewriting the code. I thought it would eventually fix itself, but it keeps spewing this out.
When I try it in a Command Prompt, it works as I ...
0
votes
0
answers
14
views
Giving application window active focus when opening a file
In the documentation for QWidget::activateWindow() function, the following is said:
... On Windows, if you are calling this when the application is not
currently the active one then it will not make ...
-2
votes
0
answers
25
views
Command exited with non-zero status 124
Given two integers n and x, find the number of triplets (a,b,c) of positive integers such that ab+ac+bc ≤ n and a+b+c ≤ x.
a,b,c are greater than 1. (c is k in my program):
#include <iostream>
...
0
votes
0
answers
32
views
Synchronize three Threads in C++ one after the other
This is in continuation to this really nice one: https://stackoverflow.com/a/33500554/22598822. That post was for the sequence (t1 & t2) --> t3. Let's say I have a program running, and there ...
1
vote
1
answer
52
views
explicit deleted constructors - does this matter?
When marking a constructor as deleted, i.e.
class MyClass {
// ...
MyClass(int x) = delete;
// ...
};
is there any effect to marking the deleted constructor as explicit? i.e.
...
-2
votes
0
answers
35
views
What does "+ +" (with space between + operators) do in C++? [duplicate]
The following code:
float a = 1.5;
float b = a + + 1.2;
compiles and actually returns 2.7 for b. Why does it compile, shouldn't the extraneous + be flagged as a syntax error?
It compiles on several ...
-2
votes
0
answers
17
views
How do I create CRUD in C++ and connect it to a database. A sample code or link to specific Youtube tutorial will be helpful. Thank you [closed]
I do not how to Create, Read, Update, and Delete database in C++
I tried to install mysql on my computer and I cannot connect it.
My laptop's operating system is windows. I am finding it difficult to ...
-12
votes
0
answers
58
views
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff8ed191184, pid=51412, tid=0x0000000000009a34 [closed]
I am writing protection for the maincraft cheat in the form of a native and when I added lazy importer I started having such errors
# A fatal error has been detected by the Java Runtime Environment:
#
...
-2
votes
0
answers
16
views
Qt6 QSGTexture not shown inside QQuickItem using custom shader classes
I try to show a simple texture through opengl and Qt6 using custom shader classes.
I created a QQuickItem which uses the updatePaintNode override to apply the QSGTexture to the custom Shader.
When I ...
-9
votes
0
answers
56
views
Chinese character turns into �� or @@ or just nothing [closed]
For example:
In run and debug:
In terminal:
When I input any Chinese, the debugging interface will show that the value of str1 is �� or @@ or just nothing, and it's a little unstable (but � is ...
1
vote
0
answers
27
views
How do I create a User Customizable popup menu from an existing CMenu?
I use MFCs CMenu to create right-click popup menus for many user commands (C++ using VS 2022). Is there already a framework for allowing user customization of these popup menus? Meaning the user will ...
-1
votes
1
answer
27
views
getting "expression list treated as compound expression in functional cast" CE, but everything looks just fine
I tried building this:
whole code (unordered_map.h): https://pastebin.com/u9aMaqRp
test: https://pastebin.com/KqrKwNt0
and got a CE out of nowhere...?
getting a strange compilation error while ...