aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/util/Private.h
blob: 6dd28bbc811bed5d6d7ef714e2025fd1cc3fe229 (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(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;
};

}

#include "Private.hpp"