Mark a struct as a reference tag by inheriting from this.
Details
A reference tag is used to identify an item in a DataBox that is a const reference to a sub-item of another item (such as a Variables or GlobalCache) in the DataBox
Derived Class Requires:
- type alias base that is the simple tag from which the reference tag is derived
- type alias argument_tags that lists tags needed to evaluate get
- static function get that, given the items fetched by argument_tags, returns a const reference to the sub-item
A reference tag may optionally specify a static std::string name() method to override the default name produced by db::tag_name.
- Warning
- A reference tag should only be derived from a simple tag and db::ReferenceTag.
Example
template <typename... Tags>
struct TaggedTuple : db::SimpleTag {
using type = tuples::TaggedTuple<Tags...>;
};
template <typename Tag, typename ParentTag>
struct FromTaggedTuple : Tag, db::ReferenceTag {
using base = Tag;
using argument_tags = tmpl::list<ParentTag>;
static const auto&
get(
const typename ParentTag::type& tagged_tuple) {
}
};
- See also
- DataBox SimpleTag