| 470 | } |
| 471 | |
| 472 | void test_bind_back() |
| 473 | { |
| 474 | // Pure function |
| 475 | static_assert(dlib::bind_back(test_bind_func, 50)(3) == -47, "this should be constexpr"); |
| 476 | DLIB_TEST(dlib::bind_back(test_bind_func, 50)(3) == -47); |
| 477 | |
| 478 | // Member function |
| 479 | static_assert(dlib::bind_back(&test_bind_func_class::minus, 50)(test_bind_func_class{3}) == -47, "this should be constexpr"); |
| 480 | DLIB_TEST(dlib::bind_back(&test_bind_func_class::minus, 50)(test_bind_func_class{3}) == -47); |
| 481 | DLIB_TEST(dlib::bind_back(&test_bind_func_class::minus, 50)(std::make_shared<test_bind_func_class>(3)) == -47); |
| 482 | |
| 483 | // Lambda |
| 484 | DLIB_TEST(dlib::bind_back([](int a, int b) {return a - b;}, 50)(3) == -47); |
| 485 | } |
| 486 | |
| 487 | // ---------------------------------------------------------------------------------------- |
| 488 |
no test coverage detected