Of course, there is no right way to do this, but I can't even think of any decent naming scheme, which is why I ask here. (So: while all answers are subjective , they will be useful , nonetheless!)
The problem is this: for simple aggregate structures, we do not use the var member prefix.
struct Info { int x; string s; size_t z; Info() : x(-1) , s() , z(0) { } };
Nevertheless, it is sometimes useful to provide a ctor initializer to initialize the structure, however - I cannot come up with a suitable naming scheme for parameters when the most natural names for them are already taken by the member variables themselves:
struct Info { int x; string s; size_t z; Info(int x?, string s?, size_t z?) : x(x?) , s(s?) , z(z?) { } };
What do other people use in this situation?
c ++ initialization naming-conventions initializer-list
Martin ba
source share