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.
806,908
questions
0
votes
0
answers
2
views
Clang fails to instantiate `operator!=()` from `operator==()` with auto-return type for a class object passed through a non-type template parameter
Consider the following code:
#include <type_traits>
struct X {
int value{};
constexpr auto operator==(const int other) const {
return value == other;
}
};
template <...
0
votes
0
answers
12
views
Access address of derived class data member in mixin constructor
In my code I have a system as outlined by the following code:
// Base class to make derived objects polymorphic
struct Base {
virtual ~Base() = default;
};
void registerData(int*) {}
template &...
0
votes
0
answers
5
views
Unable to send Long Array in request response using esp32 webserver.h
I have about 2k lines of code in html,css, js which i have stored as const char in PROGMEM of esp32 as shown below:
const char dashboard_webpage[] PROGMEM = R"rawliteral(
<!DOCTYPE html>
&...
0
votes
0
answers
6
views
PCL Corner points detection of a 3D object
As far as i've understood, a method of finding out corner points of a 3D object is to first find the point normals using normal estimation and then using curvature estimation to calculate corner ...
0
votes
1
answer
36
views
Using variant referances for the objects in c++
I have a template class that contains mutex and cv. I want to create different versions of this class and store it in a map with a enum key. Template class given as;
// A threadsafe-queue.
template &...
1
vote
1
answer
50
views
Arrays and sizeof() in C++ [duplicate]
It is said that when an array is passed as a parameter to a function, it decays into a pointer and the length of the array needs to be passed as a parameter as well. This implies that the original ...
0
votes
0
answers
13
views
How to add Cppcheck addons to Qt cretor?
I need your help. I have a problem. I use Cppcheck to do static analysis of C++ code. To do this, I have developed addons in python 3(cppcheck/addons/README.md at main - danmar/cppcheck - GitHub) so ...
0
votes
1
answer
31
views
ASAN does not detect buffer overflow
There is the following piece of code
#include <iostream>
#include <type_traits>
thread_local std::aligned_storage_t<1024> data;
int main() {
std::cout << sizeof(data) <&...
0
votes
0
answers
9
views
FFmpeg C++ API : Using HW acceleration (VAAPI) to transcode video coming from a webcam
I'm actually trying to use HW acceleration with the FFmpeg C++ API in order to transcode the video coming from a webcam (which may vary from one config to another) into a given output format (i.e: ...
1
vote
1
answer
65
views
Can this method ever throw an exception?
Consider:
template <typename T>
struct S
{
auto Value() const
{
return value;
}
T value;
};
Can Value() ever throw an exception? Why or why not? If not, is it safe to ...
0
votes
0
answers
9
views
\Makefile.win recipe for target 'OpenMp.exe' failed [duplicate]
# Project: OpenMp
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = one.o
LINKOBJ = one.o
LIBS = -L"D:/Dev-Cpp/MinGW64/lib" -L&...
-3
votes
2
answers
55
views
Type of user input C++ [duplicate]
Hi i want to make my code find out variable type of user input in C++
like:
int x;
cout<<"enter a vaild number: ";
cin>>x;
if(what i should say here to check if the variable ...
-9
votes
0
answers
39
views
Dynamic Programming Approach: Optimization or Implementation Issue? [closed]
Title:
P1809 wzy's running
Description:
wzy is running. Because it rained yesterday, rainwater accumulated in some places on the track. wzy doesn't want to step into a puddle, so when he is about to ...
-1
votes
0
answers
14
views
friend function syntax in headder file [duplicate]
I saw two different kind of syntax in operator overloading with friend. I am wondering what is the difference between them?
(A) One is this:
#ifndef HALLGATO_H
#define HALLGATO_H
#include<iostream&...