#include <cstdio>	// for printf.
#include <utility>	// for move, forward.
#include <string>	// for string.

namespace my_ns
{
	namespace miruna
	{
		template<int var_id, typename var_type, typename... ctor_arg_types>
		auto create_var(ctor_arg_types &&... args) -> var_type &
		{
			static var_type dummy{ std::forward<ctor_arg_types &&>(args)... };

			return dummy;
		}
	}

	// ここまで下準備


	struct unko // テスト用
	{
		unko(double v, int i) { std::printf("create unko %lf, %d\n", v, i); }
		unko(unko const &) { std::printf("copy\n"); }
		unko(unko &&) { std::printf("move\n"); }
		~unko() { std::printf("d-tor unkooo.\n"); }
	};

	namespace // よーしパパ(略)
	{
		int &g_i1 = miruna::create_var<1, int>(100);

		int &g_i2 = miruna::create_var<2, int>(100);

		int &g_i3 = miruna::create_var<3, int>(1000);

		double &g_d4 = miruna::create_var<4, double>(2.71828);

		unko &g_u5 = miruna::create_var<5, unko>(3.14, 8009);

		std::string &g_u6 = miruna::create_var<6, std::string>("test string...");
	}
}

///////////////////////////////

#include <iostream>
using namespace std;
auto main() -> int
{
	using namespace my_ns;
	cout << g_i1 << endl;
	cout << g_i2 << endl;
	cout << g_i3 << endl;
	cout << g_d4 << endl;
	cout << g_u6 << endl;
}
