Questions tagged [c++17]
C++17 is the version of C++ after C++14. This tag should be used (along with the [C++] tag) for questions about C++ features specific to C++17
c++17
11,125
questions
-2
votes
0
answers
21
views
C++ a single place to keep all #includes?
Gets a bit complicated with all #includes within each CPP file, is there a single place to keep all #includes?
2
votes
2
answers
56
views
Partial specialization of a class for pointer to members
I'm trying to create a function object where, given a pointer to a member, it calls std::hash of the pointed-to member (or the result of calling the function member), but there's something wrong about ...
-8
votes
0
answers
34
views
I'm planning to implement a computer vision project that requires an infrared camera for object detection and tracking [closed]
I'm going to use the AI for infrared cameras
and to do a real-time color project. Can you recommend a cheap camera? And how many computer specifications do I need?
C language will be used
nothing try ...
1
vote
1
answer
98
views
Arrays, Pointers and Memory addresses instances confusion in C++
I'm learning and playing a bit with pointers and memory addresses.
The thing is that I've tried doing some moves with instances inside arrays and getting their memory address, and I can't figure out ...
-1
votes
0
answers
29
views
invalid covariant return type for [duplicate]
Consider the following example, which is some part of the bigger codebase, in the getInstance() if I dont return a pointer to the derived class, i.e., just void or int or a different type, the ...
3
votes
1
answer
111
views
Should the inline keyword be used for variables in anonymous namespaces in a .cpp file?
If I have a constexpr defined in an anonymous namespace in a .cpp file. Should it be declared as inline? Or not?
What would be the difference between the two declarations?
// In my.cpp
namespace {
...
-2
votes
0
answers
26
views
only available with -std=c++17 or -std=gnu++17
I am currently interested in competitive programming. When i try to use features added with c++17 and later, VSCode runs my program without any problem but it always give warning like "fold-...
12
votes
1
answer
460
views
Why destructor needs to be accessible even when it is not called?
Having class X, the following object initialization:
new (ptr) X(X());
requires an accessible destructor even since C++17. Why is that, when the object is initialized by the default constructor ...
1
vote
1
answer
25
views
expand and fold parameter pack in specific way
#include <string>
#include <string_view>
template<typename... Args>
std::string_view concatenateBuffer(std::string &buffer, Args &&... args){
static_assert((std::...
0
votes
1
answer
28
views
Recognize std::execution::par C++ feature in MacOS
Does someone have any chance to make the C++ IDE on macOS Sonoma 14.5 (M3 Macbook) recognize std::execution::par from #include <execution>?
What I want is to simply compile this chunk of code:
...
0
votes
1
answer
51
views
Converting 32-Bit COM interface to 64-Bit
I am trying to convert/upgrade a 32-Bit COM file to compile as 64-Bit. I have fixed all of the bugs except for one. Here is the code in question:
HRESULT WINAPI QueryIMEDDevice(void *pV, REFIID riid,...
-4
votes
0
answers
72
views
std::optional is not available though I'm using G++9 [closed]
`error: ‘optional’ in namespace ‘std’ does not name a template type
** | std::optional<double> ;
| ^~~~~~~~
‘std::optional’ is only available from C++17 onwards
** | std::...
2
votes
1
answer
65
views
C++17: explicit first template parameter before variadic template
I am trying to write a generic class for a symmetric bloc matrix of arbitrary dimension. Only the upper triangular part is given:
A B C
D E
F
so the number of blocks is n*(n+1)/2 where n is the ...
1
vote
1
answer
71
views
Overloading Functions with Dummy Structs vs Template Specialisation
I'm refactoring some C++ and came across some dummy structs being used to differentiate between overloaded functions. I'm considering replacing this with template specialization but want to fully ...
-3
votes
0
answers
54
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
...