#include <iostream>
#include <mutex>

using namespace std;

#define DO_ONCE(callable) do { static bool _do_once_ = (callable(), true); (void)_do_once_;  }while (false)

#define \
 DO_ONCE2(callable) do { \
 static std::once_flag _do_once_ ;\
 std::call_once(_do_once_, callable); \
 \
 	} while (false)

void once_log()
{
	cout << "once call\n";	
}

void call(int a)
{
	DO_ONCE([a] {
		cout << "once: " << a << endl;
	});
	
	DO_ONCE(once_log);
	
	DO_ONCE2([a] {
		cout << "once2: " << a << endl;
	});
	
	cout << "call: " << a << endl;
}

int main() 
{
	call(1);
	call(2);

	return 0;
}