Skip to main content
spelling
Source Link
Gabriel Staples
  • 56.2k
  • 35
  • 299
  • 394

Deleting a function is a C++11 feature:

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 

[...]

The "delete" mechanism can be used for any function. For example, we can eliminate an undesired conversion like this:

struct Z { // ... Z(long long); // can initialize with ana long long  Z(long) = delete; // but not anything less }; 

Deleting a function is a C++11 feature:

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 

[...]

The "delete" mechanism can be used for any function. For example, we can eliminate an undesired conversion like this:

struct Z { // ... Z(long long); // can initialize with an long long  Z(long) = delete; // but not anything less }; 

Deleting a function is a C++11 feature:

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 

[...]

The "delete" mechanism can be used for any function. For example, we can eliminate an undesired conversion like this:

struct Z { // ... Z(long long); // can initialize with a long long Z(long) = delete; // but not anything less }; 
make clearer it's a quote, quote more relevant part
Source Link
Danica
  • 29k
  • 6
  • 94
  • 128

Defaulted and DeletedDeleting a function is C++11a C++11 feature

default and delete

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 

Conversely, we can also say explicitly that we want to default copy behavior:

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 
class Y { // ... Y& operator=(const Y&) = default; // default copy semantics Y(const Y&) = default; }; 

[...]

The "delete" mechanism can be used for any function. For example, we can eliminate an undesired conversion like this:

struct Z { // ... Z(long long); // can initialize with an long long Z(long) = delete; // but not anything less }; 

Defaulted and Deleted function is C++11 feature

default and delete

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 

Conversely, we can also say explicitly that we want to default copy behavior:

class Y { // ... Y& operator=(const Y&) = default; // default copy semantics Y(const Y&) = default; }; 

Deleting a function is a C++11 feature:

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 

[...]

The "delete" mechanism can be used for any function. For example, we can eliminate an undesired conversion like this:

struct Z { // ... Z(long long); // can initialize with an long long Z(long) = delete; // but not anything less }; 
copying data from provided link to answer to avoid deadlink in future
Source Link

Defaulted and Deleted function is C++11 feature

default and delete

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 

Conversely, we can also say explicitly that we want to default copy behavior:

class Y { // ... Y& operator=(const Y&) = default; // default copy semantics Y(const Y&) = default; }; 

Defaulted and Deleted function is C++11 feature

Defaulted and Deleted function is C++11 feature

default and delete

The common idiom of "prohibiting copying" can now be expressed directly:

class X { // ... X& operator=(const X&) = delete; // Disallow copying X(const X&) = delete; }; 

Conversely, we can also say explicitly that we want to default copy behavior:

class Y { // ... Y& operator=(const Y&) = default; // default copy semantics Y(const Y&) = default; }; 
deleted 7 characters in body
Source Link
Prasoon Saurav
  • 93.3k
  • 51
  • 245
  • 348
Loading
Source Link
Prasoon Saurav
  • 93.3k
  • 51
  • 245
  • 348
Loading