2020欧洲杯时间表

Questions tagged [c++17]

2020欧洲杯时间表 C++17 is the name of the C++ standard approved in 2017. It builds upon the previous C++14 standard, improving the core language and standard library, and adding a few new language features.

Filter by
Sorted by
Tagged with
0
votes
2answers
59 views

Is good practice to used shifted unsigned numbers as a index number of array

Defining the enum as flags in the following way typedef enum { NOT_PID = 0, PID1 = (1U << 0), PID2 = (1U << 1), NUM_PID = 3 } pid_t; ...
0
votes
1answer
36 views

working of range for loop and C-style arrays in C++ [duplicate]

C-style Arrays are not self-describing as it doesn't has any information about it's size, so for iterating it's elements we need size information somehow. I'm confused as how range-for loop gets the ...
0
votes
1answer
41 views

Compile-time Size of Struct Minus Padding

I'm trying to use Boost MPL and Fusion to calculate the size of a struct exclusive of any padding. This is my current best attempt: Live example template<class T> constexpr std::size_t ...
0
votes
1answer
60 views

Determine if a character exists within a string? (Not using loops)

I'm trying to create a funcion that returns true if a non-alphanumeric character exists within a string. I cannot use a loop, however, and I'm looking for the right algorithm to do so. ...
-2
votes
0answers
11 views

getting fatl error LNK1104: cannot open file

I am learning C++, using Visual Studio Code (the latest version as far as I know,) and am writing a basic tic-tac-toe program. I have three files:tictactoe3.cpp, utils.cpp, and utils.h. I added a ...
-1
votes
0answers
35 views

Fold expressions in c++17 [duplicate]

In c++17 there is new way to use fold expression, but i can not figurue out how does it work. in this code as i understand ... is each parameter passed to the function each iteration: template<...
0
votes
1answer
72 views

Is there any optimization or different API for page aligned memory allocations on the heap?

I am about to write a class representing a double-ended queue, just like std::dequeue, but with the capability to store any trivially destructible type, and without indexing support. Iteration or pop ...
0
votes
1answer
54 views

About `std::unique_prt<Base>& pBase= make_unique<Derived>();`

The fisrt code could not compile, whereas the second one could.Why? These codes are almost the same indeed. I would be grateful to have some help with this question. The code below could not compile....
-3
votes
0answers
23 views

how to delete files with “_[any number].” in the end of filename

I've got folder with many jpeg images. Filenames are like [any_number]_[any_string]_[any_letter]_[any_number].jpg and [any_number]_[any_string]_[any_letter].jpg What is the best (quickest) method of ...
-2
votes
0answers
41 views

How can this piece of code cause an invalid read? [closed]

So I have a piece of code that's somehow causing an Invalid read of size 8: [[nodiscard]] bool zero() const { return _bytes.size() == 1 && _bytes[0] == 0; } Sadly I have no specific ...
0
votes
1answer
51 views

Question about Introspection / static_assert (C++17)

I have a (container like) class that accepts several of my other types/classes as the data member. Now I would like to specify some properties (edit: positive integer) of the data type as compile time ...
4
votes
1answer
134 views

Does the lifetime of an array object end when its' element storage is reused?

In the subsequent quotes, I'm referring to the ISO standard draft N4713. § 6.6.3, paragraph 1 says: ...The lifetime of an object o of type T ends when: ... — the storage which the object ...
3
votes
3answers
91 views

Creating a C++ object with and without new keyword

Creating an object with new keyword: #include <iostream> #include <string> using namespace std; class Person { private: string name; public: Person(string name) { setName(...
-2
votes
0answers
58 views

“Access violation executing 0x0000000000000000” only on my laptop [closed]

When testing a program I've written on my desktop, on my laptop the program crashes with the above error. On further investigation the program crashes when I call glGenVertexArrays(1, &...
2
votes
1answer
44 views

Error in C++17 fold expression to calculate factorial

The following program gives errors in both g++ and clang... #include <iostream> #include <utility> using namespace std; //Since C++17 one can use fold expression to calculate factorial: ...

15 30 50 per page
1
2 3 4 5
388