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.
381
questions
0
votes
0
answers
21
views
Why is the computation speed of double in the Eigen library 3 times faster than that of float?
Here is my code. I created a set of matrix and vector multiplications using double type, and another set using float type. Both sets of multiplications are executed 3 million times in a for loop, and ...
0
votes
0
answers
24
views
Limiting a templated local map capacity from the constructor
I have an internal class local_map, that is templated on its capacity and object type. The declaration is as follows:
template<class K, class T, int C>
class local_map
where K is the key, T is ...
0
votes
0
answers
13
views
Custom FSavedMoveCharacter child class cannot be converted to FSavedMovePtr in AllocateNewMove Function
When using Unreal Engines built in Custom Movement Component, I understand that in order to set a custom Child of the FSavedMoveCharacter Class as the active FSavedMoveCharacter, the Function ...
-4
votes
0
answers
52
views
error: no type named ‘type’ in ‘class std::result_of<std::function<int(std::pair<int, int>&)>(std::pair<int, int>)>’ [closed]
I`m compil a test case when read <In-Depth C++11 Code Optimiszation and Engineering Level Application>, and got error, the code as follow:
#include <functional>
#include <future>
#...
0
votes
0
answers
13
views
Does GDAL combines more than one S-57 documents
I wanted to use the GDAL with Qt-C++ on my project. My purpose is to combine some files in S-57 standart and show them in a GUI. However in the documentation I couldn't catch whether GDAL combines ...
-3
votes
0
answers
36
views
Is there any way I can restrict the user from entering a negative numbers and print a message if they do enter in C++? [closed]
so there is this long set of code that I have written. It has all the basic calculations which come under mensuration. I wanted to include a way in which if users input a negative value at any point ...
-1
votes
0
answers
30
views
Printing the last line repeatedly in CSV file in c++
This is the data in my csv file
4
09-07-2024
Thnol Coffee,Iced,Large,10000,No Sweet,Normal Ice,2
Thnol Coffee,Hot,Small,8500,More Sweet,Normal Ice,1
Latte,Frappe,Large,12500,Normal Sweet,Less Ice,2
...
1
vote
1
answer
28
views
DirectX12 CPU / GPU Synchronization Question
I'm trying to understand the CPU / GPU synchronization in DirectX 12, but there are somethings that confuse me. Here is the sample code from the Microsoft's HelloFrameBuffering example:
// Prepare to ...
1
vote
2
answers
50
views
Why this constant struct can be modified in this way?
Recently I encounter the following code, it is an excerpt from tutorial of open-source package AMReX text
Array4<Real> const& a = fab1.array();
Dim3 lo = lbound(a);
Dim3 hi = ubound(...
0
votes
0
answers
22
views
Change the active partition of LTO in c++
I've been trying to change the active partition of an LTO8 tape in Windows 10 pro using the following code snippet (which gcc compiles without any warnings) but can able to change offset low
...
0
votes
0
answers
20
views
gdb core file path too long? [duplicate]
I use gdb to analyse the core dumped file.
But the output of gdb is:
GNU gdb (GDB) Amazon Linux 12.1-5.amzn2023.0.3
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 ...
4
votes
0
answers
66
views
Why direct initialization use const lvalue reference qualified conversion function?
I have two classes st and foo:
struct st {
st() = default;
st(const st&) {
std::cout << "copy ctor." << std::endl;
}
st(st&&) {
std::...
-1
votes
0
answers
38
views
C++: Why does `assert(pipe(stdin_fd) == 0)` set file descriptors to zero? [duplicate]
I am writing C++ code for inter-process-communication, where I create pipes to exchange data between parent and child (created using fork()) processes.
I declare file descriptors for setting up pipes ...
1
vote
0
answers
25
views
SDL2 Window won't show
I am trying to follow a tutorial that creates a blank window that can be closed using the Esc button, but the window never shows. This is on WSL running Ubuntu 20.05.6
The code compiles and runs ...
0
votes
1
answer
48
views
What is most efficient way to read first number from stream and skip data until delimiter [duplicate]
I want to read only first number in each line which is delimited with \n and skip other data. Example:
123 123 456 asdf\n234 ewdwedwed should be parsed, for example, into a vector with values {123, ...