Skip to main content
6 votes
1 answer
115 views

Deleting a file scope function in a header file

I am writing a header file, in which there is a void Foo() function in file scope, and I want it to be deleted. Should it be inline? void Foo() = delete; or inline void Foo() = delete;
Dr. Gut's user avatar
  • 3,335
3 votes
1 answer
150 views

Implicitly deleted function overrides deleted virtual function

This is more of a theoretical question about the interpretation of the standard in one particular case, given below: struct B; struct A { virtual bool operator ==(const B&) const = delete; }; ...
Fedor's user avatar
  • 24.5k
33 votes
2 answers
2k views

What's the point of deleted virtual functions?

Apparently you can =delete virtual functions: struct A { virtual void foo() = delete; }; struct B : A { void foo() override = delete; }; Interestingly, both functions have to be =deleted, or ...
HolyBlackCat's user avatar
3 votes
2 answers
146 views

error: use of deleted function - solution?

In error: use of deleted function an error is explained, but it is not explained how to resolve the error. Consider the following c++ code. struct foo{ int& i; }; int main() { int i = 0, ...
SmileyCraft's user avatar
2 votes
1 answer
138 views

How to check if a class has a protected member function?

Consider this simple piece of C++ code: class Foo { public: Foo() = default; }; int main() { static_assert(std::is_default_constructible_v<Foo>); return 0; } Foo has public ...
lobelk's user avatar
  • 531
1 vote
4 answers
234 views

Why are deleted member functions not propagated through derived classes?

Given the following C++ code snippet: #include <type_traits> #include <iostream> template <typename T> struct Bar { Bar() = default; Bar(const Bar&) = delete; }; ...
lobelk's user avatar
  • 531
2 votes
1 answer
126 views

Clarification about user-provided explicitly-defaulted function being implicitly defined as deleted

As per the document, which says that (emphasis mine): A function is user-provided if it is user-declared and not explicitly defaulted or deleted on its first declaration. A user-provided explicitly-...
John's user avatar
  • 3,574
1 vote
1 answer
69 views

Example of "implicit ODR-use of a non-pure virtual member function that happens to be deleted"

There is a sentence in the cppreference.com description of Deleted functions: However, implicit ODR-use of a non-pure virtual member function that happens to be deleted is allowed. Could you provide ...
Кое Кто's user avatar
2 votes
0 answers
121 views

Why - in that example with an extended lambda - is an ambigious copy constructor and some deleted function

I do not understand the behaviour of the following code: template< bool b > struct Foo { Foo() = default; __host__ Foo( const Foo & ) requires( b ) {} __device__ Foo( const Foo &...
tommsch's user avatar
  • 778
3 votes
1 answer
84 views

Effect of user deleted auto constructors on implicit generation of copy constructors

How does user deleted auto constructors affect implicit generation of copy constructors? For eg: struct Foo { Foo(X) = delete; auto operator=(X) = delete; }; int main() { Foo a; Foo b(...
Sourav Kannantha B's user avatar
0 votes
0 answers
113 views

QT QML QAbstractListModel deleted function error

I am trying to pass a c++ user model to qml and get an error that I don't understand. I use a manager class that should reads in the users and fills the listmodel. The list model itself should be pass ...
user2377283's user avatar
0 votes
0 answers
63 views

Explicitly deleted functions

we are migrating code to VS 2019 from legacy code We have an overloaded function on operator '<<' that is invoking basic_ostream function when executing the following lines. CStringArray asLine; ...
Madhu Rao's user avatar
1 vote
1 answer
149 views

Find Functions Stored in Running Python Kernel

I've done something stupid in Python, in Jupyter notebook. I deleted the cell that had my functions in it, probably a couple of hours ago, and now I don't have them any more. However, I can still run ...
Anna's user avatar
  • 21
0 votes
1 answer
255 views

Deriving from a class with a deleted destructor?

I am using CRTP to create a counter class, similar to Object Counter Additionally, classes that derive from this counter also should not be destructible. It will look something like this template <...
Nathan29006781's user avatar
5 votes
1 answer
625 views

Detect deleted function

Is there a way to detect deleted functions after overload selection (over no viable or ambiguous overloads)? void foo(); void foo(double) = delete; void foo(std::string); void foo(char, int); void ...
Jarod42's user avatar
  • 227k

15 30 50 per page
1
2 3 4 5
8