Skip to content

Tag Archives: cpp-references

Prerequisites: lvalue and rvalue in C++, References in C++“l-value” refers to a memory location that identifies an object. “r-value” refers to the data value that… Read More
Pointers and References in C++ held close relation with one another. The major difference is that the pointers can be operated on like adding values… Read More
Range-Based ‘for’ loops have been included in the language since C++11. It automatically iterates (loops) over the iterable (container). This is very efficient when used… Read More
Pointers: A pointer is a variable that holds memory address of another variable. A pointer needs to be de referenced with * operator to access… Read More
Before moving forward with using const with Reference to a Pointers, let us first see what they are one by one: Pointers are used to… Read More
Pointers in C++: Pointers are a symbolic representation of addresses. They enable programs to simulate call-by-reference as well as to create and manipulate dynamic data… Read More
To many readers, this might sound the same thing, i.e.   class_type *var = NULL; *var = &some_work; is same as class_type *var = &some_work; But… Read More
The std::is_rvalue_reference template of C++ STL is used to check whether the type is a rvalue reference type or not. It returns a boolean value… Read More
The std::is_lvalue_reference template of C++ STL is used to check whether the type is a lvalue reference type or not. It returns a boolean value… Read More
New programmers are usually in the search of ways to return multiple values from a function. Unfortunately, C and C++ do not allow this directly.… Read More
Prerequisite: Pointers vs References in C++. For clear understanding, let’s compare the usage of a “pointer to pointer” VS “Reference to pointer” in some cases.… Read More
Like references to simple data types, we can have references to pointers. // CPP program to demonstrate references to pointers. #include <iostream> using namespace std;… Read More
When class member is a vector object (not a reference).We can simply assign in constructor.   CPP // Passing vector object to a constructor. #include <iostream>… Read More
std::reference_wrapper is a class template that wraps a reference in a copy constructible and copy assignable object or reference to function of type T. Instances… Read More
In C++, we can pass parameters to a function either by pointers or by reference. In both cases, we get the same result. So, what… Read More

Start Your Coding Journey Now!