#include <iostream>
#include <ctime>
#include <cstdlib>
struct WithLogging {};
struct WithoutLogging {};
auto
function(WithLogging)
{
std::cout << "Entered function" << std::endl;
std::srand(std::time(0));
auto result = std::rand();
std::cout << "result is: " << result << std::endl;
return result;
}
auto
function(WithoutLogging)
{
return std::rand();
}
int
main()
{
auto a = function(WithLogging{});
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3RpbWU+CiNpbmNsdWRlIDxjc3RkbGliPgoKCnN0cnVjdCBXaXRoTG9nZ2luZyB7fTsKc3RydWN0IFdpdGhvdXRMb2dnaW5nIHt9OwoKCmF1dG8KZnVuY3Rpb24oV2l0aExvZ2dpbmcpCnsKCXN0ZDo6Y291dCA8PCAiRW50ZXJlZCBmdW5jdGlvbiIgPDwgc3RkOjplbmRsOwoJc3RkOjpzcmFuZChzdGQ6OnRpbWUoMCkpOwoJYXV0byByZXN1bHQgPSBzdGQ6OnJhbmQoKTsKCXN0ZDo6Y291dCA8PCAicmVzdWx0IGlzOiAiIDw8IHJlc3VsdCA8PCBzdGQ6OmVuZGw7CglyZXR1cm4gcmVzdWx0Owp9CgoKYXV0bwpmdW5jdGlvbihXaXRob3V0TG9nZ2luZykKewoJcmV0dXJuIHN0ZDo6cmFuZCgpOwp9CgoKaW50Cm1haW4oKQp7CglhdXRvIGEgPSBmdW5jdGlvbihXaXRoTG9nZ2luZ3t9KTsKCXJldHVybiAwOwp9Cgo=