#include <iostream>
#include <functional>

void print(int x) {
    std::cout << x << std::endl;
}

int main() {
    int hour_now = 5;
    auto get_hour_now = [&]() { return hour_now; };

    auto f1 = [&get_hour_now]() { print(get_hour_now() + 10); }; // Correct
    auto f2 = std::bind(print, get_hour_now() + 10); // Wrong
    auto f3 = std::bind(print, std::bind(std::plus<int>(), get_hour_now(), 10)); // Wrong
    auto f4 = std::bind(print, std::bind(std::plus<int>(), std::bind(get_hour_now), 10)); // Correct

    f1();
    f2();
    f3();
    f4();

    hour_now = 1000;

    f1(); // 1010
    f2(); // 15
    f3(); // 15
    f4(); // 1010

    return 0;
}
