C++C++11Code SnippetLanguage FeatureLearn C++

Learn About Using C++ rvalue References In The C++Builder BCC32 Compiler

BCC32, which is the classic C++Builder 32 bit compiler, includes the use of rvalue references, which allow creating a reference to temporaries. Also, rvalue references avoid unnecessary copying and make possible perfect forwarding functions. This feature is one of the C++11 features.

Rvalue references are a compound type like standard C++ references, which are referred to as lvalue references. An lvalue reference is formed by appending the ampersand character (&) to a type:

The syntax of an rvalue reference is to add && after a type:

An rvalue reference behaves like an lvalue reference, except that you can bind an rvalue reference to a temporary — an rvalue.

In the example above, SomeClass() is not bound to an identifier, so it is an rvalue and can be bound to an rvalue reference — but not an lvalue reference.

Here is the above sample code in C++Builder.

Find out more about C++ rvalue References over in the Embarcadero DocWiki.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

C++C++11C++14C++17Introduction to C++Learn C++Syntax

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?