CARLA
Memory.h
Go to the documentation of this file.
1 // Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include <boost/enable_shared_from_this.hpp>
10 #include <boost/make_shared.hpp>
11 #include <boost/shared_ptr.hpp>
12 #include <boost/weak_ptr.hpp>
13 
14 namespace carla {
15 
16  /// Use this SharedPtr (boost::shared_ptr) to keep compatibility with
17  /// boost::python, but it would be nice if in the future we can make a Python
18  /// adaptor for std::shared_ptr.
19  template <typename T>
20  using SharedPtr = boost::shared_ptr<T>;
21 
22  template <typename T>
23  using WeakPtr = boost::weak_ptr<T>;
24 
25  template <typename T>
26  using EnableSharedFromThis = boost::enable_shared_from_this<T>;
27 
28  template <typename T, typename... Args>
29  static inline auto MakeShared(Args &&... args) {
30  return boost::make_shared<T>(std::forward<Args>(args)...);
31  }
32 
33 } // namespace carla
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
Definition: Memory.h:20
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
static auto MakeShared(Args &&... args)
Definition: Memory.h:29
boost::weak_ptr< T > WeakPtr
Definition: Memory.h:23