IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
pimpl_type.hxx
Go to the documentation of this file.
1
3
4#pragma once
6
7namespace ice::concepts
8{
9
19
21 {
22 protected:
23 template<typename T>
24 struct Internal;
25
26 public:
27 template<typename T>
29
30 // TODO: Move this somewhere else!
31 PimplType(PimplType&& other) noexcept = delete;
32 auto operator=(PimplType&& other) noexcept -> PimplType& = delete;
33 PimplType(PimplType const& other) noexcept = delete;
34 auto operator=(PimplType const& other) noexcept -> PimplType& = delete;
35
36 protected:
37 template<typename Self>
38 auto internal(this Self& self) noexcept -> Internal<Self>&;
39
40 private:
41 void* _internal;
42 };
43
44
45 template<typename Self>
47 : _internal{ data }
48 {
49 }
50
51 template<typename Self>
52 auto PimplType::internal(this Self& self) noexcept -> Internal<Self>&
53 {
54 return *reinterpret_cast<Internal<Self>*>(self._internal);
55 }
56
57} // namespace ice::concepts
PimplType(Internal< T > *data) noexcept
PimplType(PimplType &&other) noexcept=delete
PimplType(PimplType const &other) noexcept=delete
auto operator=(PimplType const &other) noexcept -> PimplType &=delete
auto operator=(PimplType &&other) noexcept -> PimplType &=delete
auto internal(this Self &self) noexcept -> Internal< Self > &
Definition pimpl_type.hxx:52
Definition container_concepts.hxx:12
PimplFlags
Definition pimpl_type.hxx:11
@ None
Definition pimpl_type.hxx:12
@ NoMoveSemantics
Definition pimpl_type.hxx:15
@ Default
Definition pimpl_type.hxx:13
@ NoCopySemantics
Definition pimpl_type.hxx:16
@ NoMoveCopySemantics
Definition pimpl_type.hxx:17
Definition span.hxx:129
std::uint8_t u8
Definition types.hxx:24
Definition pimpl_type.hxx:24