aligator  0.6.1
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
clone.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "aligator/fwd.hpp"
5
6namespace aligator {
12template <typename T> struct Cloneable {
13 // non-virtual
14 shared_ptr<T> clone() const {
15 return shared_ptr<T>(static_cast<T *>(clone_impl()));
16 }
17
18protected:
19 virtual Cloneable *clone_impl() const = 0;
20};
21
22} // namespace aligator
Forward declarations.
Main package namespace.
Mixin which makes a class/class hierarchy cloneable.
Definition clone.hpp:12
virtual Cloneable * clone_impl() const =0
shared_ptr< T > clone() const
Definition clone.hpp:14