From 63a7d1607d69d0242094cbd191b2e863c8cc7027 Mon Sep 17 00:00:00 2001 From: Christos Houtouridis Date: Tue, 29 Jan 2019 15:51:02 +0200 Subject: [PATCH] Recursive de-referencable nil_ --- include/utl/meta/integral.h | 11 +++++++++-- include/utl/meta/{utility.h => invoke.h} | 0 2 files changed, 9 insertions(+), 2 deletions(-) rename include/utl/meta/{utility.h => invoke.h} (100%) diff --git a/include/utl/meta/integral.h b/include/utl/meta/integral.h index 4dda51b..4b15c65 100644 --- a/include/utl/meta/integral.h +++ b/include/utl/meta/integral.h @@ -33,8 +33,15 @@ namespace utl { namespace meta { - //! Empty type - struct nil_ { }; + /*! + * Empty type + * utl::meta's nil type is not pure nil. It's a recursive "de-referencable nil. + * Each time someone applies ::type to it, he gets back nil_. This way we can prevent + * a lot of compilation errors in a wrong meta:: handling. + */ + struct nil_ { + using type = nil_; + }; //! Type alias for \p _Tp::type. Used to extract return type of metafunctions template diff --git a/include/utl/meta/utility.h b/include/utl/meta/invoke.h similarity index 100% rename from include/utl/meta/utility.h rename to include/utl/meta/invoke.h