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.
90
questions
0
votes
0
answers
5
views
SonarQube requesting explicit cast on the result of the shift operator
I have a ton of similar issues reported by SonarQube:
m_buffer[0] = static_cast<uint32_t>(headerByte0 << 8);
Where m_buffer is an array of uint32_t, headerByte0 is uint8_t. ...
0
votes
0
answers
6
views
Getting enum type from clang::EnumConstantDecl
I'm trying to write a clang tool that finds all calls to a fucntion with variable args and returns the type of argument.
When I put in a constant enum value, for example:
static void foo(char *, ...) {...
0
votes
0
answers
9
views
Finding server port In RTSP server base on RTP with UDP transport
I want to find out Server port is RTSP server with Gstreamer when UDP is selected as Transport. This my source code it just shows Client port not server port(server port is shown = -1).
#include <...
2
votes
2
answers
51
views
Strange behavior in constructor inheritance
I have this example:
#include <iostream>
#define print(X) std::cout << X << std::endl
struct B1 {
B1(int _i = 5): i(_i) { print("B1 constructor"); };
int i;
};
...
0
votes
0
answers
42
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
27
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
14
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
56
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 ...
-1
votes
0
answers
32
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
29
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
53
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
25
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
68
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::...