Replace explicit std::funtion validity flag with usage of nullptr