Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make std::initializer_list visible. #9

Merged
merged 1 commit into from May 21, 2018
Merged

Conversation

andreasfertig
Copy link
Owner

With C++11 uniform initialization and initializer lists we cannot
longer easily see whether we are calling a normal constructor or one
which takes a initializer_list. For example:

struct V {
V(int x) {}
V(std::initializer_list x) {}

};

V v{1};
V vv{1, 2};

Surprisingly to some people, in both cases the second constructor, taking
a std::initializer_list, is used.

This change shows the difference by putting the name
std::initializer_list in front of an initializer list.

With C++11 uniform initialization and  initializer lists we cannot
longer easily see whether we are calling a normal constructor or one
which takes a initializer_list. For example:

struct V {
  V(int x) {}
  V(std::initializer_list<int> x) {}

};

V v{1};
V vv{1, 2};

Surprisingly to some people, in both cases the second constructor, taking
a std::initializer_list, is used.

This change shows the difference by putting the name
std::initializer_list<T> in front of an initializer list.
@andreasfertig andreasfertig merged commit c09cc9c into master May 21, 2018
@codecov
Copy link

codecov bot commented May 21, 2018

Codecov Report

Merging #9 into master will increase coverage by 0.08%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
+ Coverage   95.36%   95.44%   +0.08%     
==========================================
  Files          40       42       +2     
  Lines        1595     1623      +28     
==========================================
+ Hits         1521     1549      +28     
  Misses         74       74
Impacted Files Coverage Δ
Insights.cpp 95.23% <100%> (ø) ⬆️
StdInitializerListHandler.h 100% <100%> (ø)
StdInitializerListHandler.cpp 100% <100%> (ø)
CodeGenerator.cpp 93.45% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b32685f...a127948. Read the comment docs.

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.

None yet

1 participant