File: cxx-test-functional.cpp

package info (click to toggle)
libtins 4.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,956 kB
  • sloc: cpp: 34,550; ansic: 603; makefile: 13
file content (11 lines) | stat: -rw-r--r-- 233 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
#include <functional>

int add(int x, int y) {
    return x + y;
}

int main() {
    std::function<int(int, int)> func;
    func = std::bind(&add, std::placeholders::_1, std::placeholders::_2);
    return (func(2, 2) == 4) ? 0 : 1;
}