codedamn

Function objects and adaptors

Created by Abhishek Sharma about 8 months ago

0

An article from the From Novice to Expert: Mastering C++ Programming course. This article has gathered 114 views from 14140 enrolled students. Enroll into the course to read this article.

3 Comments

    0

    I find this difficult to understand. Please improve the content here

    @mohamedazimal

    Mohamed Azimal

    @mohamedazimal

    0

    #include <iostream> #include <vector> #include <algorithm> #include <functional> using namespace std;

    int main() { function<int(int, int)> add = [](const int& a, const int& b) -> int { return a + b; }; function<int(int)> square = [](const int& a) -> int { return a * a; }; function<int(int, int)> addAndSquare = [add, square](const int& a, const int& b) -> int { return square(add(a, b)); }; cout << addAndSquare(4, 2) << endl; return 0; }

    @tenzind

    tenzin dadhul

    @tenzind

    0

    Please explain things such as what a boolean is, what the <functional> library is, what std::placeholder is, what std::transfor is, what auto does, and more!

    @ruby123

    Ruby Laifr

    @ruby123

Your comment