From 99b6821d33d032566025b7de67d39710dd6516ba Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Fri, 26 Aug 2022 21:42:19 +0900 Subject: [PATCH] refactor(IsSafePtr): comply with type_traits --- src/bin/libint/iter.h | 2 +- src/bin/libint/smart_ptr.h | 24 ++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/bin/libint/iter.h b/src/bin/libint/iter.h index d8ec7628a..54b0197ab 100644 --- a/src/bin/libint/iter.h +++ b/src/bin/libint/iter.h @@ -168,7 +168,7 @@ namespace libint2 { typename SubIteratorBase::cp_rettype SubIteratorBase::pelem() const { - return PElemImpl::result>::pelem(elem()); + return PElemImpl::value>::pelem(elem()); } #if 0 diff --git a/src/bin/libint/smart_ptr.h b/src/bin/libint/smart_ptr.h index a727a825d..91755d35f 100644 --- a/src/bin/libint/smart_ptr.h +++ b/src/bin/libint/smart_ptr.h @@ -21,6 +21,7 @@ #ifndef _libint2_src_bin_libint_smartptr_h_ #define _libint2_src_bin_libint_smartptr_h_ +#include #include #if HAVE_SHARED_PTR_IN_BOOST @@ -50,27 +51,14 @@ namespace libint2 { namespace detail { /** Can be used to determine whether a type is a SafePtr */ +template +struct IsSafePtrHelper : std::false_type {}; template -struct IsSafePtr { - enum { result = false }; -}; +struct IsSafePtrHelper> : std::true_type {}; template -struct IsSafePtr< SafePtr > { - enum { result = true }; -}; -template -struct IsSafePtr< const SafePtr > { - enum { result = true }; -}; -template -struct IsSafePtr< SafePtr& > { - enum { result = true }; -}; -template -struct IsSafePtr< const SafePtr& > { - enum { result = true }; -}; +struct IsSafePtr : IsSafePtrHelper::type>::type> {}; } // namespace detail } // namespace libint2