|
|
std::size_t
is an unsigned type used for the size of something, you could use any of the unsigned integral types here if you want.std::array
is generally preferred over an ordinary array - it is aware of it size for one thing.std::vector
- this can be resized automatically or at will, so it is very handy for lots of things.
|
|
|
|
struct will not allow you to set partially an instance. |
If the number of initializer clauses is less than the number of members or initializer clauses is completely empty, the remaining members are initialized by their brace-or-equal initializers, if provided in the class definition, and otherwise (since C++14) by empty lists, which performs value-initialization. If a member of a reference type is one of these remaining members, the program is ill-formed (references cannot be value-initialized) |
Otherwise, the object is zero-initialized. |
If T is a scalar type, the object's initial value is the integral constant zero explicitly converted to T. |
|
|
uname -a echo && clang++ --version | grep clang && clang++ -std=c++14 -stdlib=libc++ -O3 -Wall -Wextra -pedantic-errors -Wno-missing-field-initializers main.cpp && ./a.out echo && g++ --version | grep GCC && g++ -std=c++14 -O3 -Wall -Wextra -pedantic-errors -Wno-missing-field-initializers main.cpp && ./a.out Linux stacked-crooked 3.2.0-74-virtual #109-Ubuntu SMP Tue Dec 9 17:04:48 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux clang version 3.6.0 (tags/RELEASE_360/final 235480) S{ a:0, b:0 c:9 } S{ a:0, b:0 c:9 } S{ a:1, b:2 c:9 } S{ a:1, b:0 c:9 } g++ (GCC) 5.2.0 S{ a:0, b:0 c:9 } S{ a:0, b:0 c:9 } S{ a:1, b:2 c:9 } S{ a:1, b:0 c:9 } |
since c++ 14 |
I dont think most compilers supports it neither c++ 17 |
explicit |
for the SFINAE , there is a keyword explicit for constructors , |
some_helper<T>::value
There is a bunch proposed for C++17: http://en.cppreference.com/w/cpp/experimental/type_trait_variable_templatesassembly does not change from the c++11 to 14 , the semantic did only . |