We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: Lambda

C++ : How to Sort a List of objects with custom Comparator or lambda function

In this example we will discuss different ways to sort a std::list of user defined data types with custom comparators or lambda functions. Suppose we have a type Player that contains Id and name. Advertisements struct Player { int id; std::string name; Player(int playerId, std::string playerName) : id(playerId), name(playerName) { } bool operator <(const Player …

C++ : How to Sort a List of objects with custom Comparator or lambda functionRead More

C++11 Lambda : How to capture local variables inside Lambda ?

In this article we will discuss how to capture local variables from outer scope in Lambda. A simple Lambda syntax is, Advertisements [Captured variables](paameters) { function code } Local variables from outer scope can be captured inside Lambda in 2 modes i.e. By Value By Reference Capturing Local Variables by value inside Lambda Function To …

C++11 Lambda : How to capture local variables inside Lambda ?Read More

C++11 Lambda : How to capture member variables inside Lambda function

In this article we will discuss how to capture member variables from outer scope. Suppose we have a class OddCounter to keep the track of odd numbers read by the object. Inside its member function we are creating a lambda function and passing to a STL algorithm std::for_each. Advertisements Now this lambda function needs to capture …

C++11 Lambda : How to capture member variables inside Lambda functionRead More

Python: How to sort a list of tuples by 2nd Item using Lambda Function or Comparator

In this article we will discuss how to sort a list of tuple using 2nd or i th item of tuple. Suppose we have a list of tuple i.e. words and thier frequency count, Advertisements # List of tuples i.e. word and its frequency count wordFreq = [ (‘the’ , 34) , (‘at’ , 23), …

Python: How to sort a list of tuples by 2nd Item using Lambda Function or ComparatorRead More

Why do we need Lambda functions in Python ? | Explained with examples.

In this article we will discuss what is a lambda function in python and why they are required. Basically what are the use cases which makes use of lambda function must. What is a lambda function ? Lambda functions are also called Anonymous functions because they don’t have any name. Also they can be assigned …

Why do we need Lambda functions in Python ? | Explained with examples.Read More

Cart

Your Cart is Empty

Back To Shop