Class Tag
Template for tag definition.

Defined in <seqan/basic.h>
Signature template <typename T> struct Tag;

Template Parameters

T Any parameterless types.

Detailed Description

This struct is defined such that parameter less tags are easier recognizeable. This is best explained with the example below.


Usually, tags are defined in the following way.

struct SomeTag_;
typedef Tag<SomeTag_> SomeTag;

They are then used as follows.

template <typename T>
void f(T const & x, SomeTag const & tag)
    // ...
// Somewhere else:
f(3, SomeTag());

This has the advantages that (1) the type of tag parameters is printed as Tag<SomeTag_> in compiler error traces. Furthermore, (2) parameter less tags can be defined redundantly in multiple headers and we can still instantiate them anywhere where they are declared. The latter (2) cannot be achieved with only forward declaration (struct SomeTag;) or full declarations (struct SomeTag {};) everywhere.