test_smart_ptr.cpp
Go to the documentation of this file.
1 /*
2  tests/test_smart_ptr.cpp -- binding classes with custom reference counting,
3  implicit conversions between types
4 
5  Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
6 
7  All rights reserved. Use of this source code is governed by a
8  BSD-style license that can be found in the LICENSE file.
9 */
10 
11 #include "object.h"
12 #include "pybind11_tests.h"
13 
14 // This breaks on PYBIND11_DECLARE_HOLDER_TYPE
15 PYBIND11_WARNING_DISABLE_GCC("-Wpedantic")
16 
17 namespace {
18 
19 // This is just a wrapper around unique_ptr, but with extra fields to deliberately bloat up the
20 // holder size to trigger the non-simple-layout internal instance layout for single inheritance
21 // with large holder type:
22 template <typename T>
23 class huge_unique_ptr {
24  std::unique_ptr<T> ptr;
25  uint64_t padding[10];
26 
27 public:
28  explicit huge_unique_ptr(T *p) : ptr(p) {}
29  T *get() { return ptr.get(); }
30 };
31 
32 // Simple custom holder that works like unique_ptr
33 template <typename T>
34 class custom_unique_ptr {
35  std::unique_ptr<T> impl;
36 
37 public:
38  explicit custom_unique_ptr(T *p) : impl(p) {}
39  T *get() const { return impl.get(); }
40  T *release_ptr() { return impl.release(); }
41 };
42 
43 // Simple custom holder that works like shared_ptr and has operator& overload
44 // To obtain address of an instance of this holder pybind should use std::addressof
45 // Attempt to get address via operator& may leads to segmentation fault
46 template <typename T>
47 class shared_ptr_with_addressof_operator {
48  std::shared_ptr<T> impl;
49 
50 public:
51  shared_ptr_with_addressof_operator() = default;
52  explicit shared_ptr_with_addressof_operator(T *p) : impl(p) {}
53  T *get() const { return impl.get(); }
54  T **operator&() { throw std::logic_error("Call of overloaded operator& is not expected"); }
55 };
56 
57 // Simple custom holder that works like unique_ptr and has operator& overload
58 // To obtain address of an instance of this holder pybind should use std::addressof
59 // Attempt to get address via operator& may leads to segmentation fault
60 template <typename T>
61 class unique_ptr_with_addressof_operator {
62  std::unique_ptr<T> impl;
63 
64 public:
65  unique_ptr_with_addressof_operator() = default;
66  explicit unique_ptr_with_addressof_operator(T *p) : impl(p) {}
67  T *get() const { return impl.get(); }
68  T *release_ptr() { return impl.release(); }
69  T **operator&() { throw std::logic_error("Call of overloaded operator& is not expected"); }
70 };
71 
72 // Custom object with builtin reference counting (see 'object.h' for the implementation)
73 class MyObject1 : public Object {
74 public:
75  explicit MyObject1(int value) : value(value) { print_created(this, toString()); }
76  std::string toString() const override { return "MyObject1[" + std::to_string(value) + "]"; }
77 
78 protected:
79  ~MyObject1() override { print_destroyed(this); }
80 
81 private:
82  int value;
83 };
84 
85 // Object managed by a std::shared_ptr<>
86 class MyObject2 {
87 public:
88  MyObject2(const MyObject2 &) = default;
89  explicit MyObject2(int value) : value(value) { print_created(this, toString()); }
90  std::string toString() const { return "MyObject2[" + std::to_string(value) + "]"; }
91  virtual ~MyObject2() { print_destroyed(this); }
92 
93 private:
94  int value;
95 };
96 
97 // Object managed by a std::shared_ptr<>, additionally derives from std::enable_shared_from_this<>
98 class MyObject3 : public std::enable_shared_from_this<MyObject3> {
99 public:
100  MyObject3(const MyObject3 &) = default;
101  explicit MyObject3(int value) : value(value) { print_created(this, toString()); }
102  std::string toString() const { return "MyObject3[" + std::to_string(value) + "]"; }
103  virtual ~MyObject3() { print_destroyed(this); }
104 
105 private:
106  int value;
107 };
108 
109 template <typename T>
110 std::unordered_set<T *> &pointer_set() {
111  // https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables
112  static auto singleton = new std::unordered_set<T *>();
113  return *singleton;
114 }
115 
116 // test_unique_nodelete
117 // Object with a private destructor
118 class MyObject4 {
119 public:
120  explicit MyObject4(int value) : value{value} {
121  print_created(this);
122  pointer_set<MyObject4>().insert(this);
123  }
124  int value;
125 
126  static void cleanupAllInstances() {
127  auto tmp = std::move(pointer_set<MyObject4>());
128  pointer_set<MyObject4>().clear();
129  for (auto *o : tmp) {
130  delete o;
131  }
132  }
133 
134 private:
135  ~MyObject4() {
136  pointer_set<MyObject4>().erase(this);
137  print_destroyed(this);
138  }
139 };
140 
141 // test_unique_deleter
142 // Object with std::unique_ptr<T, D> where D is not matching the base class
143 // Object with a protected destructor
144 class MyObject4a {
145 public:
146  explicit MyObject4a(int i) : value{i} {
147  print_created(this);
148  pointer_set<MyObject4a>().insert(this);
149  };
150  int value;
151 
152  static void cleanupAllInstances() {
153  auto tmp = std::move(pointer_set<MyObject4a>());
154  pointer_set<MyObject4a>().clear();
155  for (auto *o : tmp) {
156  delete o;
157  }
158  }
159 
160 protected:
161  virtual ~MyObject4a() {
162  pointer_set<MyObject4a>().erase(this);
163  print_destroyed(this);
164  }
165 };
166 
167 // Object derived but with public destructor and no Deleter in default holder
168 class MyObject4b : public MyObject4a {
169 public:
170  explicit MyObject4b(int i) : MyObject4a(i) { print_created(this); }
171  ~MyObject4b() override { print_destroyed(this); }
172 };
173 
174 // test_large_holder
175 class MyObject5 { // managed by huge_unique_ptr
176 public:
177  explicit MyObject5(int value) : value{value} { print_created(this); }
178  ~MyObject5() { print_destroyed(this); }
179  int value;
180 };
181 
182 // test_shared_ptr_and_references
183 struct SharedPtrRef {
184  struct A {
185  A() { print_created(this); }
186  A(const A &) { print_copy_created(this); }
187  A(A &&) noexcept { print_move_created(this); }
188  ~A() { print_destroyed(this); }
189  };
190 
191  A value = {};
192  std::shared_ptr<A> shared = std::make_shared<A>();
193 };
194 
195 // test_shared_ptr_from_this_and_references
196 struct SharedFromThisRef {
197  struct B : std::enable_shared_from_this<B> {
198  B() { print_created(this); }
199  // NOLINTNEXTLINE(bugprone-copy-constructor-init)
200  B(const B &) : std::enable_shared_from_this<B>() { print_copy_created(this); }
201  B(B &&) noexcept : std::enable_shared_from_this<B>() { print_move_created(this); }
202  ~B() { print_destroyed(this); }
203  };
204 
205  B value = {};
206  std::shared_ptr<B> shared = std::make_shared<B>();
207 };
208 
209 // Issue #865: shared_from_this doesn't work with virtual inheritance
210 struct SharedFromThisVBase : std::enable_shared_from_this<SharedFromThisVBase> {
211  SharedFromThisVBase() = default;
212  SharedFromThisVBase(const SharedFromThisVBase &) = default;
213  virtual ~SharedFromThisVBase() = default;
214 };
215 struct SharedFromThisVirt : virtual SharedFromThisVBase {};
216 
217 // test_move_only_holder
218 struct C {
219  C() { print_created(this); }
220  ~C() { print_destroyed(this); }
221 };
222 
223 // test_holder_with_addressof_operator
224 struct TypeForHolderWithAddressOf {
225  TypeForHolderWithAddressOf() { print_created(this); }
226  TypeForHolderWithAddressOf(const TypeForHolderWithAddressOf &) { print_copy_created(this); }
227  TypeForHolderWithAddressOf(TypeForHolderWithAddressOf &&) noexcept {
228  print_move_created(this);
229  }
230  ~TypeForHolderWithAddressOf() { print_destroyed(this); }
231  std::string toString() const {
232  return "TypeForHolderWithAddressOf[" + std::to_string(value) + "]";
233  }
234  int value = 42;
235 };
236 
237 // test_move_only_holder_with_addressof_operator
238 struct TypeForMoveOnlyHolderWithAddressOf {
239  explicit TypeForMoveOnlyHolderWithAddressOf(int value) : value{value} { print_created(this); }
240  ~TypeForMoveOnlyHolderWithAddressOf() { print_destroyed(this); }
241  std::string toString() const {
242  return "MoveOnlyHolderWithAddressOf[" + std::to_string(value) + "]";
243  }
244  int value;
245 };
246 
247 // test_smart_ptr_from_default
248 struct HeldByDefaultHolder {};
249 
250 // test_shared_ptr_gc
251 // #187: issue involving std::shared_ptr<> return value policy & garbage collection
252 struct ElementBase {
253  virtual ~ElementBase() = default; /* Force creation of virtual table */
254  ElementBase() = default;
255  ElementBase(const ElementBase &) = delete;
256 };
257 
258 struct ElementA : ElementBase {
259  explicit ElementA(int v) : v(v) {}
260  int value() const { return v; }
261  int v;
262 };
263 
264 struct ElementList {
265  void add(const std::shared_ptr<ElementBase> &e) { l.push_back(e); }
266  std::vector<std::shared_ptr<ElementBase>> l;
267 };
268 
269 } // namespace
270 
271 // ref<T> is a wrapper for 'Object' which uses intrusive reference counting
272 // It is always possible to construct a ref<T> from an Object* pointer without
273 // possible inconsistencies, hence the 'true' argument at the end.
274 // Make pybind11 aware of the non-standard getter member function
275 namespace PYBIND11_NAMESPACE {
276 namespace detail {
277 template <typename T>
278 struct holder_helper<ref<T>> {
279  static const T *get(const ref<T> &p) { return p.get_ptr(); }
280 };
281 } // namespace detail
282 } // namespace PYBIND11_NAMESPACE
283 
284 // Make pybind aware of the ref-counted wrapper type (s):
286 // The following is not required anymore for std::shared_ptr, but it should compile without error:
287 PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)
288 PYBIND11_DECLARE_HOLDER_TYPE(T, huge_unique_ptr<T>)
289 PYBIND11_DECLARE_HOLDER_TYPE(T, custom_unique_ptr<T>)
290 PYBIND11_DECLARE_HOLDER_TYPE(T, shared_ptr_with_addressof_operator<T>)
291 PYBIND11_DECLARE_HOLDER_TYPE(T, unique_ptr_with_addressof_operator<T>)
292 
293 TEST_SUBMODULE(smart_ptr, m) {
294  // Please do not interleave `struct` and `class` definitions with bindings code,
295  // but implement `struct`s and `class`es in the anonymous namespace above.
296  // This helps keeping the smart_holder branch in sync with master.
297 
298  // test_smart_ptr
299 
300  // Object implementation in `object.h`
301  py::class_<Object, ref<Object>> obj(m, "Object");
302  obj.def("getRefCount", &Object::getRefCount);
303 
304  py::class_<MyObject1, ref<MyObject1>>(m, "MyObject1", obj).def(py::init<int>());
305  py::implicitly_convertible<py::int_, MyObject1>();
306 
307  m.def("make_object_1", []() -> Object * { return new MyObject1(1); });
308  m.def("make_object_2", []() -> ref<Object> { return ref<Object>(new MyObject1(2)); });
309  m.def("make_myobject1_1", []() -> MyObject1 * { return new MyObject1(4); });
310  m.def("make_myobject1_2", []() -> ref<MyObject1> { return ref<MyObject1>(new MyObject1(5)); });
311  m.def("print_object_1", [](const Object *obj) { py::print(obj->toString()); });
312  m.def("print_object_2", [](ref<Object> obj) { py::print(obj->toString()); });
313  m.def("print_object_3", [](const ref<Object> &obj) { py::print(obj->toString()); });
314  m.def("print_object_4", [](const ref<Object> *obj) { py::print((*obj)->toString()); });
315  m.def("print_myobject1_1", [](const MyObject1 *obj) { py::print(obj->toString()); });
316  m.def("print_myobject1_2", [](ref<MyObject1> obj) { py::print(obj->toString()); });
317  m.def("print_myobject1_3", [](const ref<MyObject1> &obj) { py::print(obj->toString()); });
318  m.def("print_myobject1_4", [](const ref<MyObject1> *obj) { py::print((*obj)->toString()); });
319 
320  // Expose constructor stats for the ref type
321  m.def("cstats_ref", &ConstructorStats::get<ref_tag>);
322 
323  py::class_<MyObject2, std::shared_ptr<MyObject2>>(m, "MyObject2").def(py::init<int>());
324  m.def("make_myobject2_1", []() { return new MyObject2(6); });
325  m.def("make_myobject2_2", []() { return std::make_shared<MyObject2>(7); });
326  m.def("print_myobject2_1", [](const MyObject2 *obj) { py::print(obj->toString()); });
327  // NOLINTNEXTLINE(performance-unnecessary-value-param)
328  m.def("print_myobject2_2", [](std::shared_ptr<MyObject2> obj) { py::print(obj->toString()); });
329  m.def("print_myobject2_3",
330  [](const std::shared_ptr<MyObject2> &obj) { py::print(obj->toString()); });
331  m.def("print_myobject2_4",
332  [](const std::shared_ptr<MyObject2> *obj) { py::print((*obj)->toString()); });
333 
334  py::class_<MyObject3, std::shared_ptr<MyObject3>>(m, "MyObject3").def(py::init<int>());
335  m.def("make_myobject3_1", []() { return new MyObject3(8); });
336  m.def("make_myobject3_2", []() { return std::make_shared<MyObject3>(9); });
337  m.def("print_myobject3_1", [](const MyObject3 *obj) { py::print(obj->toString()); });
338  // NOLINTNEXTLINE(performance-unnecessary-value-param)
339  m.def("print_myobject3_2", [](std::shared_ptr<MyObject3> obj) { py::print(obj->toString()); });
340  m.def("print_myobject3_3",
341  [](const std::shared_ptr<MyObject3> &obj) { py::print(obj->toString()); });
342  m.def("print_myobject3_4",
343  [](const std::shared_ptr<MyObject3> *obj) { py::print((*obj)->toString()); });
344 
345  // test_smart_ptr_refcounting
346  m.def("test_object1_refcounting", []() {
347  auto o = ref<MyObject1>(new MyObject1(0));
348  bool good = o->getRefCount() == 1;
349  py::object o2 = py::cast(o, py::return_value_policy::reference);
350  // always request (partial) ownership for objects with intrusive
351  // reference counting even when using the 'reference' RVP
352  good &= o->getRefCount() == 2;
353  return good;
354  });
355 
356  // test_unique_nodelete
357  py::class_<MyObject4, std::unique_ptr<MyObject4, py::nodelete>>(m, "MyObject4")
358  .def(py::init<int>())
359  .def_readwrite("value", &MyObject4::value)
360  .def_static("cleanup_all_instances", &MyObject4::cleanupAllInstances);
361 
362  // test_unique_deleter
363  py::class_<MyObject4a, std::unique_ptr<MyObject4a, py::nodelete>>(m, "MyObject4a")
364  .def(py::init<int>())
365  .def_readwrite("value", &MyObject4a::value)
366  .def_static("cleanup_all_instances", &MyObject4a::cleanupAllInstances);
367 
368  py::class_<MyObject4b, MyObject4a, std::unique_ptr<MyObject4b>>(m, "MyObject4b")
369  .def(py::init<int>());
370 
371  // test_large_holder
372  py::class_<MyObject5, huge_unique_ptr<MyObject5>>(m, "MyObject5")
373  .def(py::init<int>())
374  .def_readwrite("value", &MyObject5::value);
375 
376  // test_shared_ptr_and_references
377  using A = SharedPtrRef::A;
378  py::class_<A, std::shared_ptr<A>>(m, "A");
379  py::class_<SharedPtrRef, std::unique_ptr<SharedPtrRef>>(m, "SharedPtrRef")
380  .def(py::init<>())
381  .def_readonly("ref", &SharedPtrRef::value)
382  .def_property_readonly(
383  "copy", [](const SharedPtrRef &s) { return s.value; }, py::return_value_policy::copy)
384  .def_readonly("holder_ref", &SharedPtrRef::shared)
385  .def_property_readonly(
386  "holder_copy",
387  [](const SharedPtrRef &s) { return s.shared; },
389  .def("set_ref", [](SharedPtrRef &, const A &) { return true; })
390  // NOLINTNEXTLINE(performance-unnecessary-value-param)
391  .def("set_holder", [](SharedPtrRef &, std::shared_ptr<A>) { return true; });
392 
393  // test_shared_ptr_from_this_and_references
394  using B = SharedFromThisRef::B;
395  py::class_<B, std::shared_ptr<B>>(m, "B");
396  py::class_<SharedFromThisRef, std::unique_ptr<SharedFromThisRef>>(m, "SharedFromThisRef")
397  .def(py::init<>())
398  .def_readonly("bad_wp", &SharedFromThisRef::value)
399  .def_property_readonly("ref",
400  [](const SharedFromThisRef &s) -> const B & { return *s.shared; })
401  .def_property_readonly(
402  "copy",
403  [](const SharedFromThisRef &s) { return s.value; },
405  .def_readonly("holder_ref", &SharedFromThisRef::shared)
406  .def_property_readonly(
407  "holder_copy",
408  [](const SharedFromThisRef &s) { return s.shared; },
410  .def("set_ref", [](SharedFromThisRef &, const B &) { return true; })
411  // NOLINTNEXTLINE(performance-unnecessary-value-param)
412  .def("set_holder", [](SharedFromThisRef &, std::shared_ptr<B>) { return true; });
413 
414  // Issue #865: shared_from_this doesn't work with virtual inheritance
415  static std::shared_ptr<SharedFromThisVirt> sft(new SharedFromThisVirt());
416  py::class_<SharedFromThisVirt, std::shared_ptr<SharedFromThisVirt>>(m, "SharedFromThisVirt")
417  .def_static("get", []() { return sft.get(); });
418 
419  // test_move_only_holder
420  py::class_<C, custom_unique_ptr<C>>(m, "TypeWithMoveOnlyHolder")
421  .def_static("make", []() { return custom_unique_ptr<C>(new C); })
422  .def_static("make_as_object", []() { return py::cast(custom_unique_ptr<C>(new C)); });
423 
424  // test_holder_with_addressof_operator
425  using HolderWithAddressOf = shared_ptr_with_addressof_operator<TypeForHolderWithAddressOf>;
426  py::class_<TypeForHolderWithAddressOf, HolderWithAddressOf>(m, "TypeForHolderWithAddressOf")
427  .def_static("make", []() { return HolderWithAddressOf(new TypeForHolderWithAddressOf); })
428  .def("get", [](const HolderWithAddressOf &self) { return self.get(); })
429  .def("print_object_1",
430  [](const TypeForHolderWithAddressOf *obj) { py::print(obj->toString()); })
431  // NOLINTNEXTLINE(performance-unnecessary-value-param)
432  .def("print_object_2", [](HolderWithAddressOf obj) { py::print(obj.get()->toString()); })
433  .def("print_object_3",
434  [](const HolderWithAddressOf &obj) { py::print(obj.get()->toString()); })
435  .def("print_object_4",
436  [](const HolderWithAddressOf *obj) { py::print((*obj).get()->toString()); });
437 
438  // test_move_only_holder_with_addressof_operator
439  using MoveOnlyHolderWithAddressOf
440  = unique_ptr_with_addressof_operator<TypeForMoveOnlyHolderWithAddressOf>;
441  py::class_<TypeForMoveOnlyHolderWithAddressOf, MoveOnlyHolderWithAddressOf>(
442  m, "TypeForMoveOnlyHolderWithAddressOf")
443  .def_static("make",
444  []() {
445  return MoveOnlyHolderWithAddressOf(
446  new TypeForMoveOnlyHolderWithAddressOf(0));
447  })
448  .def_readwrite("value", &TypeForMoveOnlyHolderWithAddressOf::value)
449  .def("print_object",
450  [](const TypeForMoveOnlyHolderWithAddressOf *obj) { py::print(obj->toString()); });
451 
452  // test_smart_ptr_from_default
453  py::class_<HeldByDefaultHolder, std::unique_ptr<HeldByDefaultHolder>>(m, "HeldByDefaultHolder")
454  .def(py::init<>())
455  // NOLINTNEXTLINE(performance-unnecessary-value-param)
456  .def_static("load_shared_ptr", [](std::shared_ptr<HeldByDefaultHolder>) {});
457 
458  // test_shared_ptr_gc
459  // #187: issue involving std::shared_ptr<> return value policy & garbage collection
460  py::class_<ElementBase, std::shared_ptr<ElementBase>>(m, "ElementBase");
461 
462  py::class_<ElementA, ElementBase, std::shared_ptr<ElementA>>(m, "ElementA")
463  .def(py::init<int>())
464  .def("value", &ElementA::value);
465 
466  py::class_<ElementList, std::shared_ptr<ElementList>>(m, "ElementList")
467  .def(py::init<>())
468  .def("add", &ElementList::add)
469  .def("get", [](ElementList &el) {
470  py::list list;
471  for (auto &e : el.l) {
472  list.append(py::cast(e));
473  }
474  return list;
475  });
476 }
Eigen::internal::print
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Definition: NEON/PacketMath.h:3115
B
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition: bench_gemm.cpp:49
PYBIND11_WARNING_DISABLE_GCC
#define PYBIND11_WARNING_DISABLE_GCC(name)
Definition: wrap/pybind11/include/pybind11/detail/common.h:67
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
copy
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Definition: level1_impl.h:29
E1::B
@ B
detail
Definition: testSerializationNonlinear.cpp:69
A
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:48
print_copy_created
void print_copy_created(T *inst, Values &&...values)
Definition: constructor_stats.h:282
Object
Reference counted object base class.
Definition: object.h:9
add
graph add(PriorFactor< Pose2 >(1, priorMean, priorNoise))
l
static const Line3 l(Rot3(), 1, 1)
TEST_SUBMODULE
TEST_SUBMODULE(smart_ptr, m)
Definition: test_smart_ptr.cpp:293
holder_helper
Definition: cast.h:753
PYBIND11_NAMESPACE
Definition: test_custom_type_casters.cpp:24
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
Eigen::Triplet< double >
E1::A
@ A
PYBIND11_NAMESPACE::detail::holder_helper< ref< T > >::get
static const T * get(const ref< T > &p)
Definition: test_smart_ptr.cpp:279
Object::toString
virtual std::string toString() const =0
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
print_move_created
void print_move_created(T *inst, Values &&...values)
Definition: constructor_stats.h:288
pybind11_tests.h
std
Definition: BFloat16.h:88
print_destroyed
void print_destroyed(T *inst, Values &&...values)
Definition: constructor_stats.h:314
p
float * p
Definition: Tutorial_Map_using.cpp:9
ref
Reference counting helper.
Definition: object.h:67
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
Object::getRefCount
int getRefCount() const
Return the current reference count.
Definition: object.h:18
uint64_t
unsigned __int64 uint64_t
Definition: ms_stdint.h:95
PYBIND11_DECLARE_HOLDER_TYPE
#define PYBIND11_DECLARE_HOLDER_TYPE(type, holder_type,...)
Create a specialization for custom holder types (silently ignores std::shared_ptr)
Definition: cast.h:872
get
Container::iterator get(Container &c, Position position)
Definition: stdlist_overload.cpp:29
gtsam::operator&
DiscreteKeys operator&(const DiscreteKey &key1, const DiscreteKey &key2)
Create a list from two keys.
Definition: DiscreteKey.cpp:45
test_callbacks.value
value
Definition: test_callbacks.py:162
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Eigen::internal::cast
EIGEN_DEVICE_FUNC NewType cast(const OldType &x)
Definition: Eigen/src/Core/MathFunctions.h:460
print_created
void print_created(T *inst, Values &&...values)
Definition: constructor_stats.h:309
object.h


gtsam
Author(s):
autogenerated on Wed Mar 19 2025 03:06:19