Macro
SEQAN_CONCEPT
Defines a new concept.
SEQAN_CONCEPT(name, params)
Include Headers
seqan/basic.h
Parameters
name
Concept identifier. Non-trivial concepts should have an identifier with a "Concept"-suffix.
params
Template paramter list in parantheses, e.g. (T) or (T1)(T2). Typically, template parameters are models, i.e. one or multiple classes that should be checked for fulfilling a concept.
Remarks: This is a sequence of the Boost Preprocessor Library, read more.
Remarks
A concept is implemented as a template struct with name name and arguments params. The concept checking should be part of the struct definition. Associated types should be checked via SEQAN_CONCEPT_ASSERT and valid expressions in a function SEQAN_CONCEPT_USAGE, see below. Variables used in valid expressions should be (private) struct members instead of local variables in member functions (read more).
Examples
SEQAN_CONCEPT(Assignable,(T))
{
    SEQAN_CONCEPT_USAGE(Assignable)
    {
        a = b;              // require assignment operator
        constConstraints(b);
    }
private:
    void constConstraints(const T& x)
    {
        a = x;              // const required for argument to assignment
        ignoreUnusedVariableWarning(x);
    }
private:
    T a;
    T b;
};
 
SEQAN_CONCEPT(EqualityComparable,(T))
{
    SEQAN_CONCEPT_USAGE(EqualityComparable)
    {
        requireBooleanExpr(a == b);
        requireBooleanExpr(a != b);
    }
private:
    T a, b;
};
SeqAn - Sequence Analysis Library - www.seqan.de
 

Page built @2013/07/11 09:12:37