Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
-2 votes
0 answers
27 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> ...
Aditya Raj's user avatar
0 votes
0 answers
27 views

Extension of lifetime for inner fields when the type's lifetime is extended?

I am pondering about a piece of tooling code that we were using for a while here now, but which I suspect is actual undefined behaviour (at least, I got a couple of debugging sessions where it looks ...
Immanuel Scholz's user avatar
0 votes
0 answers
118 views

const char* vs std::string_view for constants [closed]

I usually use constexpr const char* for defining string constants. Of late, I have been noticing that std::string_view is very popular for this purpose. Which of these is the best? // 1. char pointer ...
0Nicholas's user avatar
  • 437
-3 votes
1 answer
50 views

Optimize memory in operators overload and template structures

The task: In this task you have to write a structure that will work both like a regular array in C and like a list in Python. Namely, write a structure template<typename T> struct FlexArray; ...
user26492712's user avatar
-1 votes
0 answers
50 views

<wx/wxprec.h> file not found [duplicate]

I've been trying to learn C++ and I started to learn about GUIs, but I've encountered some problems. I am using wxWidgets 3.2.5, downloaded it by source on the official website but I can't get It to ...
user22615570's user avatar
1 vote
1 answer
80 views

How do I use std::reference_wrapper to store the reference in an std::unordered_map?

I'm trying to learn the use of std::reference_wrapper and std::ref and the use cases of it. Here is a sample code I wrote. Please help me solve the compilation error. And it would be great if you can ...
Aman Kumar's user avatar
-1 votes
1 answer
81 views

JNI CallStaticObjectMethod is causing crash with Java 21

The company I work for recently moved to Java 21 from Java 8, which updated the JNI version as well that is used with interoperatibility with C++. All the function (written in C++) called through JNI ...
StewieGGriffin's user avatar
-1 votes
0 answers
47 views

Matplot++- dealing with linker errors as a novice

I have installed matplot++ using vcpkg and compiled it with c++17. Working in visual studio 2022, I tried to copy a basic example from its github: #include <cmath> #include <matplot/matplot.h&...
Ron  Tubman's user avatar
1 vote
1 answer
80 views

What is error: expected unqualified-id before ‘(’ token?

I clone this open source project https://github.com/balfieri/cordic. I encountered issue below after following README to run $ g++ -std=c++17 -o test_basic test_basic.cpp $ g++ -std=c++17 -o ...
RookieRyan's user avatar
1 vote
0 answers
69 views

Argument passing and dangling pointers [duplicate]

I know that, in general, when calling a function, the evaluation of the arguments of the function call can happen in any order, but I'm in doubt about this particular situation (imagine T has a move ...
ABu's user avatar
  • 11.4k
1 vote
1 answer
90 views

Does early return of the same variable prevent NRVO?

Here is the code: std::vector<int> foo(bool cond) { std::vector<int> result; if (cond) { return result; // (1) } result.push_back(42); return result; ...
Dmitry Kuzminov's user avatar
4 votes
1 answer
110 views

correct syntax to access a template variable specialization

assume a template variable in data.h: template <class T> struct Data { Data() = delete; Data(T initValue) : value(initValue){} T value; }; template<class T> extern Data<T&...
Alexander's user avatar
  • 758
2 votes
2 answers
63 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 ...
ABu's user avatar
  • 11.4k
1 vote
1 answer
110 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 ...
Ferran Rojas's user avatar
-1 votes
0 answers
34 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 ...
GPrathap's user avatar
  • 7,670

15 30 50 per page
1
2 3 4 5
699