We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: or

C++ Map: Erase by Value or Callback while iterating | erase_if for map

In this article we will discuss two different ways to erase elements from map i.e. In previous article we discussed how to erase elements by key and iterator using member function std::map::erase. But there is no default function to delete elements by value instead of key or delete elements based on callback. Advertisements We will …

C++ Map: Erase by Value or Callback while iterating | erase_if for mapRead More

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++ : How to read or write objects in file | Serializing & Deserializing Objects

In this article we will discuss how to write objects to file and how to read them back from to file and fill in object. Suppose we have a class Student i.e. class Student { public: std::string mName; std::string mId; std::string mPhoneNumber; Student(std::string id = “”, std::string name = “”, std::string phone = “”) : …

C++ : How to read or write objects in file | Serializing & Deserializing ObjectsRead More

C++ : Check if given path is a file or directory using Boost & C++17 FileSystem Library

In this article we will discuss different ways to check if given path is of file or directory that exists using Boost Filesystem Library & C++17 Filesystem Library. Both Boost Filesystem library & C++17 Experimental filesystem library provides certain functions that we are going to use here,  Advertisements bool exists(const path& p); In Boost Library’s …

C++ : Check if given path is a file or directory using Boost & C++17 FileSystem LibraryRead More

C++: How to get filename from a path with or without extension | Boost | C++17 FileSytem Library

In this article we will discuss different ways to get filename from a path with or without extension using, Boost Filesystem Library C++17 Filesystem Library Prior to c++11 Days Suppose we have a file path i.e. Advertisements “/home/user/sample/temp/data.csv” We want to fetch file name from this path i.e. “data.csv” and “data” (With or without extension). …

C++: How to get filename from a path with or without extension | Boost | C++17 FileSytem LibraryRead More

Python : How to Check if an item exists in list ? | Search by Value or Condition

In this article we will discuss different ways to check if a given element exists in list or not. Table of Contents Introduction Check if element exists in list using python “in” Operator Check if element exist in list using list.count() function Check if element exist in list based on custom logic Introduction Suppose we …

Python : How to Check if an item exists in list ? | Search by Value or ConditionRead More

Python : Sort a List of numbers in Descending or Ascending Order | list.sort() vs sorted()

In this article we will discuss how to sort a list of numbers in ascending and descending order using two different techniques. list.sort() vs sorted() list’s sort() function In Python, list provides a member function sort() that can sorts the calling list in place. Advertisements sorted() Function It’s a built in function that accepts an …

Python : Sort a List of numbers in Descending or Ascending Order | list.sort() vs sorted()Read More

Cart

Your Cart is Empty

Back To Shop