diff options
Diffstat (limited to 'compat/is-complete.hpp')
-rw-r--r-- | compat/is-complete.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compat/is-complete.hpp b/compat/is-complete.hpp new file mode 100644 index 00000000..d6bba88b --- /dev/null +++ b/compat/is-complete.hpp @@ -0,0 +1,21 @@ +#pragma once + +namespace floormat::detail_type_traits { + +namespace { template<class T> class IsComplete_ { + // from <Corrade/Containers/Pointer.h> + template<class U> static char get(U*, decltype(sizeof(U))* = nullptr); + static short get(...); + public: + enum: bool { value = sizeof(get(static_cast<T*>(nullptr))) == sizeof(char) }; +}; } // namespace + +} // namespace floormat::detail_type_traits + +namespace floormat { + +template<typename T> +constexpr inline bool is_complete = + bool(::floormat::detail_type_traits::IsComplete_<T>::value); + +} // namespace floormat |