kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #31308
[PATCH 12/12] Use std::remove_pointer instead of own implementation (NFC)
---
include/core/typeinfo.h | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h
index 34c3324e6..537171348 100644
--- a/include/core/typeinfo.h
+++ b/include/core/typeinfo.h
@@ -28,19 +28,7 @@
#ifndef SWIG
-#include <cstdio>
-
-template<typename T>
-struct remove_pointer
-{
- typedef T type;
-};
-
-template<typename T>
-struct remove_pointer<T*>
-{
- typedef typename remove_pointer<T>::type type;
-};
+#include <type_traits>
/**
* Function IsA()
@@ -52,13 +40,13 @@ struct remove_pointer<T*>
template <class T, class I>
bool IsA( const I* aObject )
{
- return aObject && remove_pointer<T>::type::ClassOf( aObject );
+ return aObject && std::remove_pointer<T>::type::ClassOf( aObject );
}
template <class T, class I>
bool IsA( const I& aObject )
{
- return remove_pointer<T>::type::ClassOf( &aObject );
+ return std::remove_pointer<T>::type::ClassOf( &aObject );
}
/**
@@ -72,10 +60,10 @@ bool IsA( const I& aObject )
template<class Casted, class From>
Casted dyn_cast( From aObject )
{
- if( remove_pointer<Casted>::type::ClassOf ( aObject ) )
+ if( std::remove_pointer<Casted>::type::ClassOf ( aObject ) )
return static_cast<Casted>( aObject );
- return NULL;
+ return nullptr;
}
class EDA_ITEM;
--
2.14.1
References