Helios++
Helios software for LiDAR simulations
SmartSharedFunctorContainer.h
1 #pragma once
2 
3 #include <memory>
4 
11 template <typename T>
13 protected:
14  // *** ATTRIBUTES *** //
15  // ******************** //
19  std::shared_ptr<T> f;
20 
21 public:
22  // *** CONSTRUCTION / DESTRUCTION *** //
23  // ************************************ //
28  SmartSharedFunctorContainer(std::shared_ptr<T> f) : f(f) {}
29  virtual ~SmartSharedFunctorContainer() {}
30 
31  // *** FUNCTOR OPERATOR *** //
32  // ************************** //
36  virtual inline void operator() (){(*f)();}
37 };
Functor container can be used to wrap any element so its functor () is called while having a shared p...
Definition: SmartSharedFunctorContainer.h:12
SmartSharedFunctorContainer(std::shared_ptr< T > f)
Default constructor for the smart shared functor container.
Definition: SmartSharedFunctorContainer.h:28
virtual void operator()()
Functor to the contained element's functor.
Definition: SmartSharedFunctorContainer.h:36
std::shared_ptr< T > f
Container object which must have a callable functor ()
Definition: SmartSharedFunctorContainer.h:19