Nein, das ist die Structure Inizialisierung:Mathias hat geschrieben:Habe ich das richtig gesehen, in C++ gibt es auch eine Art with ?
Code: Alles auswählen
struct {int a, b,c} a = {.a=5, .b=10, .c=0};
struct {int a,b,c} b = {5, 10, 0}; // würde ich nicht empfehlen, kann bei größeren structs schnell in die hose gehen
Code: Alles auswählen
#define WITH(T) do { struct WITH : T { void operator()() {
#define ENDWITH(X) }}; static_cast<WITH&>((X))(); } while(0)
struct Bar {
int field;
};
void foo( Bar &b ) {
WITH( Bar )
cerr << field << endl;
ENDWITH( b );
}