diff options
Diffstat (limited to 'include/openvic-dataloader/detail/SelfType.hpp')
-rw-r--r-- | include/openvic-dataloader/detail/SelfType.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/openvic-dataloader/detail/SelfType.hpp b/include/openvic-dataloader/detail/SelfType.hpp new file mode 100644 index 0000000..5366aef --- /dev/null +++ b/include/openvic-dataloader/detail/SelfType.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include <type_traits> + +namespace ovdl::detail { +#pragma GCC diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" +#pragma GCC diagnostic ignored "-Wnon-template-friend" + template<typename T> + struct Reader { + friend auto adl_GetSelfType(Reader<T>); + }; + + template<typename T, typename U> + struct Writer { + friend auto adl_GetSelfType(Reader<T>) { return U {}; } + }; +#pragma GCC diagnostic pop + + inline void adl_GetSelfType() {} + + template<typename T> + using Read = std::remove_pointer_t<decltype(adl_GetSelfType(Reader<T> {}))>; +} |