Skip to main content
Filter by
Sorted by
Tagged with
4 votes
0 answers
218 views

After update, my Visual Studio compiler started producing "warning C5267: definition of implicit assignment operator for 'Value' is deprecated because it has a user-provided destructor" with ...
Jarek C's user avatar
  • 1,281
1 vote
0 answers
75 views

In the following code, only Bar3 fails. What is the reason behind this static assertion failure? #include <concepts> struct Bar1 { Bar1() = default; bool val = false; }; static_assert(std::...
MarkB's user avatar
  • 2,230
0 votes
0 answers
1k views

I got myself an error sprouting from std::optional. Now when trying to reconstruct it, there seems to be something going on with defaulted ctors that I don't yet understand. Consider the following ...
glades's user avatar
  • 5,374
8 votes
1 answer
292 views

Assume we have procedure void f(X2);. Further assume we have types X1 and X2 that do not share an inheritance hierarchy. We want to call it like this: f(X1{}) and have X1 implicitly convert into X2. ...
Post Self's user avatar
  • 1,582
3 votes
1 answer
407 views

I've written this code: #include<iostream> using namespace std; class Student { public: string name; int age; Student() { cout<<"Default constructor&...
RAHUL JANGRA's user avatar
0 votes
0 answers
281 views

Is there any way to emulate C++ template specialization using C# generics and/or rtti? Consider following functions, implementation details do not matter: public void DrawShape(Shape sh, Brush brush1, ...
noisy cat's user avatar
  • 3,075
2 votes
3 answers
1k views

Like many people I'm in the habit of writing new string functions as functions of const std::string &. The advantages are efficiency (you can pass existing std::string objects without incurring ...
jez's user avatar
  • 15.5k
0 votes
1 answer
347 views

I want to detect during compile time (static assertion) whether a class meets both the following conditions: Has an implicit default constructor (i.e., no user-defined default constructor). Has at ...
Eran Bentov's user avatar
5 votes
1 answer
411 views

Given the following code #include <iostream> using namespace std; template <typename Type> struct Something { Something() { cout << "Something()" << endl; } ...
Curious's user avatar
  • 21.3k
4 votes
2 answers
5k views

One more time about this, but the related questions do not answer my question. The standard is pretty clear: 12.8 Copying and moving class objects, §9 If the definition of a class X does not ...
Kiril Kirov's user avatar
  • 38.5k