SpECTRE  v2024.09.29
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
make_list< Ts > Struct Template Reference

Metafunction to turn a parameter pack into a typelist. More...

#include <TmplDebugging.hpp>

Public Types

using type = implementation defined
 

Detailed Description

template<class... Ts>
struct make_list< Ts >

Metafunction to turn a parameter pack into a typelist.

This metafunction is really only useful for debugging metaprograms. For example, the desired algorithm might be:

using variables_tags_from_single_tags = tmpl::filter<
extracted_from_variables,
tmpl::bind<tmpl::found, tmpl::pin<mutated_tags_list>,
tmpl::bind<std::is_same, tmpl::_1, tmpl::parent<tmpl::_1>>>>;

However, getting the tmpl::pin, tmpl::parent, and tmpl::bind calls right can be extremely frustrating with little help as to what is going on. Let's introduce an error by pinning tmpl::_1:

using variables_tags_from_single_tags = tmpl::filter<
extracted_from_variables,
tmpl::bind<tmpl::found, tmpl::pin<mutated_tags_list>,
tmpl::bind<std::is_same, tmpl::pin<tmpl::_1>,
tmpl::parent<tmpl::_1>>>>;

The result is comparing all values in extracted_from_variables to themselves. To find this out, replace tmpl::filter and tmpl::found with tmpl::transform, and the metafunction std::is_same to make_list. You will then get back a "backtrace" of what the algorithm did, which is invaluable for getting the tmpl::pin and tmpl::parent right. That is,

using variables_tags_from_single_tags2 = tmpl::transform<
extracted_from_variables,
tmpl::bind<tmpl::transform, tmpl::pin<mutated_tags_list>,
tmpl::bind<make_list, tmpl::_1, tmpl::parent<tmpl::_1>>>>;
void transform(const gsl::not_null< History< DestVars > * > dest, const History< SourceVars > &source, ValueTransformer &&value_transformer, DerivativeTransformer &&derivative_transformer)
Initialize a History object based on the contents of another, applying a transformation to each value...
Definition: History.hpp:1046
Get compiler error with type of template parameter.
Definition: TmplDebugging.hpp:31

You will get an output along the lines of:

src/DataStructures/DataBox.hpp:1181:40: error: implicit instantiation of
undefined template
'TypeDisplayer<brigand::list<brigand::list<
brigand::list<test_databox_tags::ScalarTag,
test_databox_tags::Tag0>, brigand::list<test_databox_tags::ScalarTag,
Tags::Variables<brigand::list<test_databox_tags::ScalarTag,
test_databox_tags::VectorTag> > > >,
brigand::list<brigand::list<test_databox_tags::VectorTag,
test_databox_tags::Tag0>,
brigand::list<test_databox_tags::VectorTag,
Tags::Variables<
brigand::list<test_databox_tags::ScalarTag,
test_databox_tags::VectorTag> > > > > >'
See also
TypeDisplayer

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