struct Box {
Box() { puts("default"); }
Box(Box const&) { puts("copy"); }
Box(int, float) { puts("int, float"); }
Box(int) { puts("int"); }
Box(Box&&) { puts("move"); }
}
Box box1 = {34}; // chooses Box(int) copy-list-initialization
Box box2 = 34; // chooses Box(int) copy initialization
// But if -fno-elide-constructors flag been used,
// box1 prints only int
// box2 prints int and move
- Why move constructor is not called in the case of box1 being initialized with a temporary?
- if initializer_list constructor is provided which takes int eg( Box(std::initializer_list) {} ), braced init list always calls init list c'tor. why? using c++ 14 clang