Questions tagged [c++]

C++ is a general-purpose programming language. It was originally designed as an extension to C and has a similar syntax, but it is now a completely different language. Use this tag for questions about code (to be) compiled with a C++ compiler. Use a version-specific tag for questions related to a specific standard revision [C++11], [C++14], [C++17], [C++20] or [C++23], etc.

-3 votes
1 answer
22 views

realize Serialize, Deserialize [closed]

Implement serialization and deserialization functions of a two-linked list in binary format in file. The algorithmic complexity of the solution should be less than quadratic. I can't figure out how ...
user avatar
0 votes
1 answer
33 views

How to use std::list next?

I tried to make playlist with std::list but it's difficult to implement now, next, previous help me std::list<int> mlist; std::list<int>::iterator head; head=mlist.begin(); std::cout <&...
user avatar
1 vote
1 answer
35 views

Why `std::async` itself could not find suitable overloading, whereas lambda could?

Note: I don't ask about how to make the below code snippet work, there are already some posts about that question. What am I conscious about is why std::async itself could not find matched function, ...
user avatar
  • 2,469
0 votes
0 answers
25 views

I do not know why my itertaor p reference to null when I try to output the value in main(), but I can output it in my class [duplicate]

I cannot solve a bug. When I try to output an element in a position in main class, an exception is thrown. In the function makeSet(), I can output the element. I do not know if my data type of makeSet(...
user avatar
  • 1
1 vote
0 answers
14 views

Temporarily clear Linux terminal while program is running in C++

If you look at programs like Nano, Vim, or sl, it clears your screen while the program is running and opens a "new screen." Once the program is finished running, the original terminal with ...
user avatar
0 votes
1 answer
29 views

VS code C++ Class constructor error using x{x} format

I installed all required environments to run a c++ file, but when I tried to use the constructor format functionName(arguments): x{x}, y{y} {} it doesn't compile. The program works perfectly fine when ...
user avatar
0 votes
0 answers
15 views

GetFileAttributesW API throws ‘system cannot find the file specified’

In my VC++ application, I am selecting a couple of text files by invoking File Explorer and using the GetFileAttributesW() API to retrieve file system attributes. GetFileAttributesW() is failing to ...
user avatar
5 votes
0 answers
38 views

Common way to indicate non-legal value for many types without UB

I'm writing some kind of (open-addressing) hash table. For all valid types T that I want to allow to be contained in my hash table, I want some non-legal value for that type to indicate that the table ...
user avatar
  • 598
0 votes
0 answers
18 views

What does AdditionalDependencies in an Unreal .uproject file mean?

In an Unreal Engine .uproject file there is a Modules section which lists the project-specific modules with a source code folder under the Source folder. Each such module definition has an ...
user avatar
0 votes
0 answers
27 views

What does the "deprecated in C++98" indicate? [duplicate]

The quotation below is seen at cppreference: std::strstreambuf Defined in header <strstream> class strstreambuf : public std::basic_streambuf (deprecated in C++98) What does the (deprecated ...
user avatar
  • 2,469
0 votes
0 answers
12 views

C++ error: (eosio contract): Decomposes into 2 elements but only 1 names were provided

I get this error when trying to compile the contract. The specified code: basic::tradeparams basic::get_defi_trade_data(asset tokens, symbol to){ sx::registry::defibox_table defi_table( "...
user avatar
  • 1
0 votes
1 answer
27 views

How to improve on this solution (C++ array iteration)?

This is my solution to the problem of finding a value inside a C++ array: #include <iostream> #include <sys/resource.h> #include <stdio.h> #include <stdlib.h> #include <...
user avatar
  • 1,225
0 votes
0 answers
8 views

boost asio cancellation signal

code snippet: template<typename CompletionToken> boost::awaitable<int> async_op(CompletionToken) {...} boost::asio::cancellation_signal cancel_signal; ... auto value = co_await async_op(...
user avatar
-3 votes
0 answers
53 views

How pointers are casted in C++? [closed]

The program was asked in GATE. Please try to explain the output. #include<iostream> using namespace std; int main() { char str[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char a = str[...
user avatar
0 votes
2 answers
32 views

Segmentation fault when calling a member function using a derived pointer [duplicate]

Can anyone tell me why calling d->method1() in the code below leads to a segmentation fault in c++? class Base{ public: virtual void method1() {} void method2() {} }; class ...
user avatar

15 30 50 per page
1
2 3 4 5
51242