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

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

#include "lldb/Utility/Cloneable.h"

Inheritance diagram for lldb_private::Cloneable< Derived, Base >:
Inheritance 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> {};
A class that implements CRTP-based "virtual constructor" idiom.
Definition: Cloneable.h:40

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.

Referenced by lldb_private::OptionValueFileSpecList::Clone().


The documentation for this class was generated from the following file: