#include <cstdio>

template<typename Func>
void hoge(Func f) {
	puts("初期化処理内容");
	f(); // メイン処理内容
	puts("終了処理処理");
}

int main(void) {
	hoge([]{
		puts("メイン処理内容");
	});
	return 0;
}
