aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/util/Private.h
blob: fc3728fabf18fafacb4fd1793c98bf3bf7335bc2 (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
32
33
34
#pragma once

#include <typeindex>
#include <functional>

namespace crepe {

class Private {
public:
	Private() = default;
	~Private();
	Private(Private &&);
	Private & operator=(Private &&);
	Private(const Private &) = delete;
	Private & operator=(const Private &) = delete;

	template <typename T>
	T & get();

	template <typename T, typename... Args>
	void set(Args &&... args);

	bool empty() const noexcept;

private:
	std::function<void(void *)> destructor;
	std::type_index type = typeid(void);
	void * instance = nullptr;
};

}

#include "Private.hpp"