not a problem but I am a big fan of factoring unless you think your conditions may change drastically later.
if this is pretty much what its going to be, just say
#if condition
dim is 2
#else
dim is 3 //don't repeat this many times.
followed by a section for conditions for the other one.
Avoid identifiers that begins with an underscore (like _dim and _nnodeLtc) in the global namespace.
In addition, some identifiers are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required.
- Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use.
- Each identifier that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
This can done using structured binding - but then dim_ and nNodeLtc_ are not constexpr - just const - as constexpr can't be used with structured binding
actually, I will go out on a limb an say that it is getting less readable as you move more and more into compacted modern forms.
Clever, yes. Readable to the intern you just hired? Nope. Do I do this stuff too? Yes.
There is the potential for a rather nasty bug when using #pragma once :
Unlike header guards, this pragma makes it impossible to erroneously use the same macro name in more than one file. On the other hand, since with #pragma once files are excluded based on their filesystem-level identity, this can't protect against including a header twice if it exists in more than one location in a project.
On the other hand, since with #pragma once files are excluded based on their filesystem-level identity, this can't protect against including a header twice if it exists in more than one location in a project.
On the other other hand, if you're doing something silly like bringing in the same dependency from multiple places willy-nilly, or having symlinks in your build tree, you'll likely run into secondary problems either way, and the fact that your project doesn't build is relatively benign.