Varun

C++ : Convert double to string and manage precision | scientific notation

In this article we will discuss different ways to convert double to String or char array with or without precision i.e. double to String using C++11’s std::to_string std::to_string is introduced in c++11. Example to convert double to std::string using to_string is as follows, double num = 6789898989.33999443; //Converting using std::to_string std::string str = std::to_string(num); Output:

C++ : Convert double to string and manage precision | scientific notation Read More »

How to Capture Member Variables in Lambda function in C++?

In this article, we will discuss how to capture member variables from the outer scope. Wrong way to capture member variable in Lambda — Compile Error Suppose we have a class OddCounter to keep track of the odd numbers read by the object. Inside its member function, we are creating a lambda function and passing

How to Capture Member Variables in Lambda function in C++? Read More »

C++11 Lambda: Capture Variables by Reference or Value

Lambda Functions were introduced in C++11, and it allows us to write Inline, Anonymous Functions. Lambda Functions are also called Lambda Expressions. These Lambda expressions/functions are particularly useful when you need to pass a small function as an argument to another function as callbacks, such as a sorting algorithm or a thread constructor. In this

C++11 Lambda: Capture Variables by Reference or Value Read More »

Scroll to Top