Skip to content

Corrections constructor#3

Open
sv-91 wants to merge 1 commit into
AlexeyAB:masterfrom
sv-91:master
Open

Corrections constructor#3
sv-91 wants to merge 1 commit into
AlexeyAB:masterfrom
sv-91:master

Conversation

@sv-91

@sv-91 sv-91 commented Oct 11, 2019

Copy link
Copy Markdown

2 correction:

  1. std::forward
  2. make_safe instead constructor

@AlexeyAB

Copy link
Copy Markdown
Owner

A few words why is it better to use make_safe instead constructor?

@sv-91

sv-91 commented Oct 11, 2019

Copy link
Copy Markdown
Author

Template parameter in the constructor sometimes causes a compilation error. Since the compiler cannot distinguish 2 constructors.

template
A(B &&)

and

A(const A&)

https://mpark.github.io/programming/2014/06/07/beware-of-perfect-forwarding-constructors/

Instead of this method, you can try sfinae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants