C++

lvalue & rvalue

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

Një lvalue është diçka me emër dhe adresë që vazhdon të ekzistojë (një variabël). Një rvalue është vlerë e përkohshme që zhduket menjëherë (rezultati i a + b). Referencat && kapin rvalue-t — dhe janë baza e move semantics.

EnglishEN

An lvalue is something with a name and address that keeps existing (a variable). An rvalue is a temporary value that vanishes straight away (the result of a + b). && references bind to rvalues — and are the basis of move semantics.

Si ta mendosh

lvalue është si shtëpia jote — ka adresë dhe qëndron. rvalue është si një pako që sapo arriti dhe do hidhet — mund t'i marrësh brendinë pa i kërkuar leje askujt.

Lexoje në anglisht

An lvalue is like your house — it has an address and stays put. An rvalue is like a parcel that's just arrived and is about to be thrown out — you can take what's inside without asking anyone.

Shembull kodicpp

int a = 5;          // a është lvalue
int b = a + 2;      // a + 2 është rvalue
int&& r = a + 2;    // referencë rvalue

Terma të lidhur