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

#include <functional>
#include <typeindex>

namespace crepe {

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

	template <typename T>
	T & get();

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

	bool empty() const noexcept;

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

} // namespace crepe

#include "Private.hpp"