[Orxonox-commit 6123] r10781 - code/branches/cpp11_v2/src/libraries/core/command
landauf at orxonox.net
landauf at orxonox.net
Sun Nov 8 21:10:30 CET 2015
Author: landauf
Date: 2015-11-08 21:10:30 +0100 (Sun, 08 Nov 2015)
New Revision: 10781
Modified:
code/branches/cpp11_v2/src/libraries/core/command/ExecutorPtr.h
code/branches/cpp11_v2/src/libraries/core/command/FunctorPtr.h
Log:
in C++11 it's now possible to define 'typedefs' for templates (called 'alias template')
Modified: code/branches/cpp11_v2/src/libraries/core/command/ExecutorPtr.h
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/command/ExecutorPtr.h 2015-11-08 17:19:12 UTC (rev 10780)
+++ code/branches/cpp11_v2/src/libraries/core/command/ExecutorPtr.h 2015-11-08 20:10:30 UTC (rev 10781)
@@ -52,21 +52,10 @@
namespace orxonox
{
- /// ExecutorPtr is just a typedef of SharedPtr
- typedef SharedPtr<Executor> ExecutorPtr;
-
- /// ExecutorStaticPtr is just a typedef of SharedChildPtr
- typedef SharedChildPtr<ExecutorStatic, ExecutorPtr> ExecutorStaticPtr;
-
- /// It's not possible to use a typedef for ExecutorMemberPtr<T>, so we have to create a child-class instead. It inherits all functions from SharedChildPtr, but needs to (re-)implement some constructors.
+ using ExecutorPtr = SharedPtr<Executor>;
+ using ExecutorStaticPtr = SharedChildPtr<ExecutorStatic, ExecutorPtr>;
template <class T>
- class ExecutorMemberPtr : public SharedChildPtr<ExecutorMember<T>, ExecutorPtr>
- {
- public:
- inline ExecutorMemberPtr() : SharedChildPtr<ExecutorMember<T>, ExecutorPtr>() {}
- inline ExecutorMemberPtr(ExecutorMember<T>* pointer) : SharedChildPtr<ExecutorMember<T>, ExecutorPtr>(pointer) {}
- inline ExecutorMemberPtr(const SharedPtr<ExecutorMember<T>>& other) : SharedChildPtr<ExecutorMember<T>, ExecutorPtr>(other) {}
- };
+ using ExecutorMemberPtr = SharedChildPtr<ExecutorMember<T>, ExecutorPtr>;
}
#endif /* _ExecutorPtr_H__ */
Modified: code/branches/cpp11_v2/src/libraries/core/command/FunctorPtr.h
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/command/FunctorPtr.h 2015-11-08 17:19:12 UTC (rev 10780)
+++ code/branches/cpp11_v2/src/libraries/core/command/FunctorPtr.h 2015-11-08 20:10:30 UTC (rev 10781)
@@ -54,31 +54,12 @@
namespace orxonox
{
- /// FunctorPtr is just a typedef of SharedPtr
- typedef SharedPtr<Functor> FunctorPtr;
-
- /// It's not possible to use a typedef for FunctorMemberPtr<T>, so we have to create a child-class instead. It inherits all functions from SharedChildPtr, but needs to (re-)implement some constructors.
+ using FunctorPtr = SharedPtr<Functor>;
template <class T>
- class FunctorMemberPtr : public SharedChildPtr<FunctorMember<T>, FunctorPtr>
- {
- public:
- inline FunctorMemberPtr() : SharedChildPtr<FunctorMember<T>, FunctorPtr>() {}
- inline FunctorMemberPtr(FunctorMember<T>* pointer) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(pointer) {}
- inline FunctorMemberPtr(const SharedPtr<FunctorMember<T>>& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
- };
-
- /// FunctorStaticPtr is just FunctorMemberPtr with @a T = void
- typedef FunctorMemberPtr<void> FunctorStaticPtr;
-
- /// It's not possible to use a typedef for FunctorPointerPtr<T>, so we have to create a child-class instead. It inherits all functions from SharedChildPtr, but needs to (re-)implement some constructors.
+ using FunctorMemberPtr = SharedChildPtr<FunctorMember<T>, FunctorPtr>;
+ using FunctorStaticPtr = FunctorMemberPtr<void>;
template <class F, class T>
- class FunctorPointerPtr : public SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T>>
- {
- public:
- inline FunctorPointerPtr() : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T>>() {}
- inline FunctorPointerPtr(FunctorPointer<F, T>* pointer) : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T>>(pointer) {}
- inline FunctorPointerPtr(const SharedPtr<FunctorPointer<F, T>>& other) : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T>>(other) {}
- };
+ using FunctorPointerPtr = SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T>>;
}
#endif /* _FunctorPtr_H__ */
More information about the Orxonox-commit
mailing list