5 Ağustos 2019 Pazartesi

prvalue Nedir

this Değeri
Açıklaması şöyle. Yani this anahtar kelimesi artık prvalue
Starting from C++98, this is an rvalue and as such cannot be assigned (i.e. cannot appear on the left from an assignment operator). Starting from C++11, this is specified as a prvalue.
void
Şöyle yaparız. Aslında bu ko çok saçma ancak void tipinden prvalue kurulabileceğini göstermek için ekledim. Eğer var değişkeni null değilse member() metodu çalıştırılır. null ise bir tane void prvalue döndürülür.
var ? var->member() : void();
Açıklaması şöyle.
You are just "constructing" a prvalue (not a variable, for the reason suggested in the comments), of type void, just as int() would default-construct an int.

Hiç yorum yok:

Yorum Gönder