SpECTRE  v2024.04.12
Registration::Registrar< Registrant, Args > Struct Template Reference

A template for defining a registrar. More...

#include <Registration.hpp>

Public Types

template<typename RegistrarList >
using f = Registrant< Args..., RegistrarList >
 

Detailed Description

template<template< typename... > class Registrant, typename... Args>
struct Registration::Registrar< Registrant, Args >

A template for defining a registrar.

A registrar for a class can be defined by making a type alias to this struct, filling in the registrant.

template <typename SomeArg, typename Registrars>
class Derived2;
namespace Registrars {
template <typename SomeArg>
} // namespace Registrars
template <typename SomeArg,
typename Registrars = tmpl::list<Registrars::Derived2<SomeArg>>>
class Derived2 : public Base<Registrars> {
public:
static constexpr Options::String help = "help";
using options = tmpl::list<>;
int func() const override { return 2; }
};
const char *const String
The string used in option structs.
Definition: String.hpp:8
A template for defining a registrar.
Definition: Registration.hpp:42

In more complex cases (such as with non-type template parameters) defining a registrar manually may be necessary.

template <int N, typename Registrars>
class Derived3;
namespace Registrars {
template <int N>
struct Derived3 {
template <typename RegistrarList>
using f = ::Derived3<N, RegistrarList>;
};
} // namespace Registrars
template <int N, typename Registrars = tmpl::list<Registrars::Derived3<N>>>
class Derived3 : public Base<Registrars> {
public:
static constexpr Options::String help = "help";
using options = tmpl::list<>;
int func() const override { return N; }
};

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