11,187
questions
1
vote
1
answer
26
views
NLOpt vector-valued inequality constraint function signature in C++
I'm working on implementing a nonlinear optimization problem using the NLOpt library, and I'm having some trouble defining a vector-valued inequality constraint using the C++ interface.
The NLOpt docs ...
1
vote
1
answer
11
views
boost beast async read argument overload or mismatching
AsyncReadStream& stream,
DynamicBuffer& buffer,
basic_parser< isRequest >& parser,
ReadHandler&& handler = net::default_completion_token_t< executor_type< ...
0
votes
1
answer
33
views
How to mock dll function using Gmock?
I have searched on this and did not find much information. May be I need to search more, still, I will proceed with asking the question here.
I have a below pattern of code where I have 1 class ...
-1
votes
0
answers
28
views
error C2955 "use of class template requires template argument list" with C++17 Standards when default template parameter is provided
I have a project which compiled well years ago,but when I compiled it recently,it gives me the error "use of class template requires template argument list",the code line causes this error ...
-2
votes
1
answer
147
views
How to iterate over an enumeration with a ranged-for loop [duplicate]
#define DEFINE_ENUM_CLASS(Name, ...) \
enum class Name { __VA_ARGS__ }; \
constexpr const char* Name##Strings[] = { #__VA_ARGS__ };
int main()
{
DEFINE_ENUM_CLASS(Color, Red, Green, Blue);
...
0
votes
3
answers
90
views
How do I pass different data types in a variadic function, with parameter folds?
Edit: Reformatting the entire question
Making a Linked List lib, and I wanted to pass through multiple values in order to make the appending of items easier, so I created some Variadic Functions, ...
-1
votes
0
answers
77
views
How to add enums into a set in modern C++?
I am working with about 10 different numbers that are constant and represent product ids and would like to find the fastest and most readable way to represent the semantics of the products without ...
-2
votes
0
answers
40
views
Calculate tiles for L-shape [closed]
I got an assignment for programming my C++ programming class that wants user input of an L-shape and its size. The user enters l1, l2, l3 and l4. Then the user enters a tile size.
This tile is then ...
0
votes
1
answer
33
views
uWebSockets C++ error on send(): cork buffer must not be acquired without checking cancork
I'm developing a websoscket server for an embedded system. The requirements are very simple: send updates to a list of signals ids the webapp subscribes to. Everything works fine until the crash ...
1
vote
1
answer
64
views
Potential Memory Leak and Performance Concerns with CWinThread in MFC OnTimer Event
I am a new developer working with MFC, and I have a question about CWinThread. I have an OnTimer event that checks whether the position values of all axes are 0. Additionally, I have a function that ...
1
vote
1
answer
82
views
Copy elision when function returns a local variable and temporary via different paths
I have a class Foo
class Foo {
public:
Foo(std::string s) : s_(std::move(s)) {
std::cout << "Constructor " << s_ << "\n";
}
~Foo() {
...
2
votes
2
answers
38
views
Use of std::future vs. std::thread in grep clone
I wrote a grep clone recently. It does a recursive search of a string query through all files of a specified directory. The core of program is the function shown below.
/** Do recursive search of ...
-2
votes
0
answers
70
views
Memory leaks despite freeing the pointer in C++ [closed]
I'm implementing a doubly linked list in C++. In my insert function, which adds an element to the list, I wrote the following code:
DoublyLinkedList.h:
template <class T>
void DoublyLinkedList&...
2
votes
1
answer
90
views
How to wait for another thread to loop again?
In my C++17 application I have a thread that runs an endless loop, doing some work (taking some seconds each time) in each iteration.
Now I want to wait in another thread (or in multiple other threads)...
0
votes
1
answer
43
views
Cannot access a private class even using a friend class [duplicate]
I am learning C++ and game design using comp4300. In the assignment 2 of the class, the instructor uses a friend class to access the entity class, but I am not able to do that and I get an error:
...