Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/command/FunctorPtr.h

    r7401 r11071  
    3232    @brief Typedefs and definitions of FunctorPtr, FunctorMemberPtr, FunctorStaticPtr, and FunctorPointerPtr
    3333
    34     Instances of orxonox::Functor are usually managed by an orxonox::SharedPtr. This ensures
     34    Instances of orxonox::Functor are usually managed by an std::shared_ptr. This ensures
    3535    that Functors will be destroyed after usage. To make things easier, there's a typedef
    36     that defines FunctorPtr as SharedPtr<Functor>.
     36    that defines FunctorPtr as std::shared_ptr<Functor>.
    3737
    3838    Because there's not only orxonox::Functor, but also orxonox::FunctorStatic, and
     
    5151
    5252#include "core/CorePrereqs.h"
    53 #include "util/SharedPtr.h"
     53#include <memory>
    5454
    5555namespace orxonox
    5656{
    57     /// FunctorPtr is just a typedef of SharedPtr
    58     typedef SharedPtr<Functor> FunctorPtr;
    59 
    60     /// 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.
     57    using FunctorPtr = std::shared_ptr<Functor>;
    6158    template <class T>
    62     class FunctorMemberPtr : public SharedChildPtr<FunctorMember<T>, FunctorPtr>
    63     {
    64         public:
    65             inline FunctorMemberPtr() : SharedChildPtr<FunctorMember<T>, FunctorPtr>() {}
    66             inline FunctorMemberPtr(FunctorMember<T>* pointer) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(pointer) {}
    67             inline FunctorMemberPtr(const SharedPtr<FunctorMember<T> >& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
    68     };
    69 
    70     /// FunctorStaticPtr is just FunctorMemberPtr with @a T = void
    71     typedef FunctorMemberPtr<void> FunctorStaticPtr;
    72 
    73     /// 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.
     59    using FunctorMemberPtr = std::shared_ptr<FunctorMember<T>>;
     60    using FunctorStaticPtr = std::shared_ptr<FunctorMember<void>>;
    7461    template <class F, class T>
    75     class FunctorPointerPtr : public SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >
    76     {
    77         public:
    78             inline FunctorPointerPtr() : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >() {}
    79             inline FunctorPointerPtr(FunctorPointer<F, T>* pointer) : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >(pointer) {}
    80             inline FunctorPointerPtr(const SharedPtr<FunctorPointer<F, T> >& other) : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >(other) {}
    81     };
     62    using FunctorPointerPtr = std::shared_ptr<FunctorPointer<F, T>>;
    8263}
    8364
Note: See TracChangeset for help on using the changeset viewer.