LLDB  mainline
Public Member Functions | List of all members
lldb_private::Cloneable< Derived, Base > Class Template Reference

#include "lldb/Utility/Cloneable.h"

Inheritance diagram for lldb_private::Cloneable< Derived, Base >:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::Cloneable< Derived, Base >:
Collaboration graph
[legend]

Public Member Functions

std::shared_ptr< typename Base::TopmostBase > Clone () const override
 

Detailed Description

template<typename Derived, typename Base>
class lldb_private::Cloneable< Derived, Base >

A class that implements CRTP-based "virtual constructor" idiom.

Example:

class Base {
using TopmostBase = Base;
public:
virtual std::shared_ptr<Base> Clone() const = 0;
};

To define a class derived from the Base with overridden Clone:

class Intermediate : public Cloneable<Intermediate, Base> {};

To define a class at the next level of inheritance with overridden Clone:

class Derived : public Cloneable<Derived, Intermediate> {};

Definition at line 40 of file Cloneable.h.

Member Function Documentation

◆ Clone()

template<typename Derived , typename Base >
std::shared_ptr<typename Base::TopmostBase> lldb_private::Cloneable< Derived, Base >::Clone ( ) const
inlineoverride

Definition at line 44 of file Cloneable.h.


The documentation for this class was generated from the following file:
lldb_private::Cloneable::Clone
std::shared_ptr< typename Base::TopmostBase > Clone() const override
Definition: Cloneable.h:44
Base