summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-2/baseref.hpp
blob: 8fbcc91e356d812656f4b30d49c3e5e48ddbad3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include "common.hpp"

#include "funcs.hpp"

#include "../level-1/common.hpp"

#include <functional>

namespace intellect {
namespace level2 {

template <typename ref>
struct baseref : public level1::baseref<ref>
{
	using level1::template baseref<ref>::baseref;

	// thread-local context
	static ref & context() { return level2::context(); }

	template <typename... Refs>
	ref operator()(ref first, Refs... rest) { return level2::dohabit(self, {first, rest...}); }
	template <typename... Pairs>
	ref operator()(std::initializer_list<ref> first, Pairs... rest) { return level2::dohabit(self, {first, rest...}); }

	ref operator()() { return level2::dohabit(self); }
};

}
}