# Group Logic Metaprogramming
Logic Metaprogramming operations.

## Grouped Metafunction Overview

- `And<TLhs, TRhs>::Type;, And<TLhs, TRhs>::VALUE;`
  Metaprograming "and" operatand.
- `AndC<LHS, RHS>::Type;, AndC<LHS, RHS>::VALUE;`
  Metaprograming boolean "and" operator.
- `Eval<VALUE>::Type`
  Conversion from `bool` to tags `True` and `False`.
- `If<TCondition, TResultTrue, TResultFalse>::Type`
  Metaprogramming implication.
- `If<CONDITION, TResultTrue, TResultFalse>::Type`
  Metaprogramming boolean, implication.
- `Not<TBool>::Type;, Not<TBool>::VALUE;`
  Metaprograming boolean "not" operator.
- `NotC<BOOL>::Type;, NotC<BOOL>::VALUE;`
  Metaprograming boolean "not" operator for values.
- `Or<TLhs, TRhs>::Type;, Or<TLhs, TRhs>::VALUE;`
  Metaprograming "or" operator.
- `OrC<LHS, RHS>::Type;, OrC<LHS, RHS>::VALUE;`
  Metaprograming boolean "or" operator.

## Detailed Description

This group contains metafunctions for logical operations.

For each boolean operation, there is one metafunction called `Operation` and one called `OperationC` (i.e. having a suffix `C`. The first one works on boolean tag types `True` and `False`. The second one takes `bool` constant parameters.

The metafunctions allow a shortcut using the SFNAE (substitution failure is not an error) feature of the C++ programming language. When passing metafunctions returning `True` and `False` in their `Type` member typedef, you can ommit the `::Type`.

Here is an example for this:

        typedef And<Or<True, False>, True> TResult;
        printBoolType(TResult());  // => "true"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

## See Also

- False
- True

## Grouped Metafunctions Detail

### `And<TLhs, TRhs>::Type; And<TLhs, TRhs>::VALUE;`

Defined in
  <seqan/basic.h>

Metaprograming "and" operatand.

#### Template Parameters

`TLhs` | The left hand side logical value tag.
`TRhs` | The right hand side logical value tag.

#### Returns

`Type` | The logical value tag result fand the and operation.
`VALUE` | Shandtcut fand `And<TLhs, TRhs>::Type::VALUE`.

#### Example

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code using And.

        printBoolType(And<False, False>::Type());  // => "false"
        printBoolType(And<False, True>::Type());   // => "true"
        printBoolType(And<True, False>::Type());   // => "true"
        printBoolType(And<True, True>::Type());    // => "true"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

### `AndC<LHS, RHS>::Type; AndC<LHS, RHS>::VALUE;`

Defined in
  <seqan/basic.h>

Metaprograming boolean "and" operator.

#### Template Parameters

`LHS` | Left hand side `bool` constant.
`RHS` | Right hand side `bool` constant.

#### Returns

`Type` | The logical value tag result for the or operation.
`VALUE` | Shortcut for `AndC<LHS, RHS>::Type::VALUE`.

#### Example

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code using AndC.

        printBoolType(AndC<false, false>::Type());  // => "false"
        printBoolType(AndC<false, true>::Type());   // => "true"
        printBoolType(AndC<true, false>::Type());   // => "true"
        printBoolType(AndC<true, true>::Type());    // => "true"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

### `Eval<VALUE>::Type`

Defined in
  <seqan/basic.h>

Conversion from `bool` to tags `True` and `False`.

#### Template Parameters

`VALUE` | A `bool` to convert to `True`/`False`.

#### Returns

`Type` | The resulting tag, one of `True` and `False`.

#### Examples

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code and achieve the following output:

        printBoolType(Eval<true>::Type());  // => "true"
        printBoolType(Eval<false>::Type()); // => "false"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

### `If<TCondition, TResultTrue, TResultFalse>::Type`

Defined in
  <seqan/basic.h>

Metaprogramming implication.

#### Template Parameters

`TCondition` | The condition.
`TResultTrue` | Result if TCondition evaluates to `True`.
`TResultFalse` | Result if TCondition evaluates to `False`.

#### Returns

`Type` | The resulting type.

#### Example

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code using If.

        printBoolType(If<True, True, False>::Type());   // => "true"
        printBoolType(If<True, False, True>::Type());   // => "false"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

### `If<CONDITION, TResultTrue, TResultFalse>::Type`

Defined in
  <seqan/basic.h>

Metaprogramming boolean, implication.

#### Template Parameters

`CONDITION` | The condition, `bool`.
`TResultTrue` | Result if TCondition evaluates to `True`.
`TResultFalse` | Result if TCondition evaluates to `False`.

#### Returns

`Type` | The resulting type.

#### Example

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code using If.

        printBoolType(If<True, True, False>::Type());   // => "true"
        printBoolType(If<True, False, True>::Type());   // => "false"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

### `Not<TBool>::Type; Not<TBool>::VALUE;`

Defined in
  <seqan/basic.h>

Metaprograming boolean "not" operator.

#### Template Parameters

`TBool` | The tag to negate.

#### Returns

`Type` | The inverted TBool.
`VALUE` | Shortcut for `Not<TBool>::Type::VALUE`.

#### Example

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code using Not.

        printBoolType(Not<False>::Type());  // => "true"
        printBoolType(Not<True>::Type());   // => "false"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

### `NotC<BOOL>::Type; NotC<BOOL>::VALUE;`

Defined in
  <seqan/basic.h>

Metaprograming boolean "not" operator for values.

#### Template Parameters

`BOOL` | The `bool` value to negate.

#### Returns

`Type` | The corresponding Tag for `!BOOL` (`True`/`False`).
`VALUE` | Shortcut for `NotC<BOOL>::Type::VALUE`.

#### Example

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code using NotC.

        printBoolType(NotC<false>::Type());  // => "true"
        printBoolType(NotC<true>::Type());   // => "false"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

### `Or<TLhs, TRhs>::Type; Or<TLhs, TRhs>::VALUE;`

Defined in
  <seqan/basic.h>

Metaprograming "or" operator.

#### Template Parameters

`TLhs` | The left hand side logical value tag.
`TRhs` | The right hand side logical value tag.

#### Returns

`Type` | The logical value tag result for the or operation.
`VALUE` | Shortcut for `Or<TLhs, TRhs>::Type::VALUE`.

#### Example

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code using Or.

        printBoolType(Or<False, False>::Type());  // => "false"
        printBoolType(Or<False, True>::Type());   // => "true"
        printBoolType(Or<True, False>::Type());   // => "true"
        printBoolType(Or<True, True>::Type());    // => "true"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

### `OrC<LHS, RHS>::Type; OrC<LHS, RHS>::VALUE;`

Defined in
  <seqan/basic.h>

Metaprograming boolean "or" operator.

#### Template Parameters

`LHS` | Left hand side `bool` constant.
`RHS` | Right hand side `bool` constant.

#### Returns

`Type` | The logical value tag result for the or operation.
`VALUE` | Shortcut for `OrC<LHS, RHS>::Type::VALUE`.

#### Example

We define the following two helper functions.

    void printBoolType(True const & /*tag*/)
    {
        std::cout << "true" << std::endl;
    }

    void printBoolType(False const & /*tag*/)
    {
        std::cout << "false" << std::endl;
    }

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

Now, we can write the following code using OrC.

        printBoolType(OrC<false, false>::Type());  // => "false"
        printBoolType(OrC<false, true>::Type());   // => "true"
        printBoolType(OrC<true, false>::Type());   // => "true"
        printBoolType(OrC<true, true>::Type());    // => "true"

Snippet from: demos/dox/basic/metaprogramming_logic.cpp

#### Dox Sources

    /*!
     * @defgroup LogicMetaprogramming Logic Metaprogramming
     *
     * @brief Logic Metaprogramming operations.
     *
     * This group contains metafunctions for logical operations.
     *
     * For each boolean operation, there is one metafunction called
     * <tt>Operation</tt> and one called <tt>OperationC</tt> (i.e. having a suffix
     * <tt>C</tt>. The first one works on boolean tag types <tt>True</tt> and
     * <tt>False</tt>. The second one takes <tt>bool</tt> constant parameters.
     *
     * The metafunctions allow a shortcut using the SFNAE (substitution failure is
     * not an error) feature of the C++ programming language. When passing
     * metafunctions returning <tt>True</tt> and <tt>False</tt> in their
     * <tt>Type</tt> member typedef, you can ommit the <tt>::Type</tt>.
     *
     * Here is an example for this:
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp shortcut to type feature
     *
     * @see LogicalValuesTags#True
     * @see LogicalValuesTags#False
     *
     * @mfn LogicMetaprogramming#Eval
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Conversion from <tt>bool</tt> to tags <tt>True</tt> and
     *        <tt>False</tt>.
     *
     * @signature Eval<VALUE>::Type
     *
     * @tparam VALUE A <tt>bool</tt> to convert to <tt>True</tt>/<tt>False</tt>.
     *
     * @return Type The resulting tag, one of <tt>True</tt> and <tt>False</tt>.
     *
     * @section Examples
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code and achieve the following output:
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type eval
     *
     *
     *
     * @mfn LogicMetaprogramming#Not
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Metaprograming boolean "not" operator.
     *
     * @signature Not<TBool>::Type;
     * @signature Not<TBool>::VALUE;
     *
     * @tparam TBool The tag to negate.
     *
     * @return Type The inverted TBool.
     * @return VALUE Shortcut for <tt>Not&lt;TBool&gt;::Type::VALUE</tt>.
     *
     * @section Example
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code using Not.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type not
     *
     *
     *
     * @mfn LogicMetaprogramming#NotC
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Metaprograming boolean "not" operator for values.
     *
     * @signature NotC<BOOL>::Type;
     * @signature NotC<BOOL>::VALUE;
     *
     * @tparam BOOL The <tt>bool</tt> value to negate.
     *
     * @return Type The corresponding Tag for <tt>!BOOL</tt>
     *              (<tt>True</tt>/<tt>False</tt>).
     * @return VALUE Shortcut for <tt>NotC&lt;BOOL&gt;::Type::VALUE</tt>.
     *
     * @section Example
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code using NotC.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type notc
     *
     *
     *
     * @mfn LogicMetaprogramming#Or
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Metaprograming "or" operator.
     *
     * @signature Or<TLhs, TRhs>::Type;
     * @signature Or<TLhs, TRhs>::VALUE;
     *
     * @tparam TLhs The left hand side logical value tag.
     * @tparam TRhs The right hand side logical value tag.
     *
     * @return Type The logical value tag result for the or operation.
     * @return VALUE Shortcut for <tt>Or<TLhs, TRhs>::Type::VALUE</tt>.
     *
     * @section Example
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code using Or.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type or
     *
     *
     *
     * @mfn LogicMetaprogramming#OrC
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Metaprograming boolean "or" operator.
     *
     * @signature OrC<LHS, RHS>::Type;
     * @signature OrC<LHS, RHS>::VALUE;
     *
     * @tparam LHS Left hand side <tt>bool</tt> constant.
     * @tparam RHS Right hand side <tt>bool</tt> constant.
     *
     * @return Type The logical value tag result for the or operation.
     * @return VALUE Shortcut for <tt>OrC<LHS, RHS>::Type::VALUE</tt>.
     *
     * @section Example
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code using OrC.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type orc
     *
     *
     *
     * @mfn LogicMetaprogramming#And
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Metaprograming "and" operatand.
     *
     * @signature And<TLhs, TRhs>::Type;
     * @signature And<TLhs, TRhs>::VALUE;
     *
     * @tparam TLhs The left hand side logical value tag.
     * @tparam TRhs The right hand side logical value tag.
     *
     * @return Type The logical value tag result fand the and operation.
     * @return VALUE Shandtcut fand <tt>And<TLhs, TRhs>::Type::VALUE</tt>.
     *
     * @section Example
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code using And.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type and
     *
     *
     *
     * @mfn LogicMetaprogramming#AndC
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Metaprograming boolean "and" operator.
     *
     * @signature AndC<LHS, RHS>::Type;
     * @signature AndC<LHS, RHS>::VALUE;
     *
     * @tparam LHS Left hand side <tt>bool</tt> constant.
     * @tparam RHS Right hand side <tt>bool</tt> constant.
     *
     * @return Type The logical value tag result for the or operation.
     * @return VALUE Shortcut for <tt>AndC<LHS, RHS>::Type::VALUE</tt>.
     *
     * @section Example
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code using AndC.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type andc
     *
     *
     *
     * @mfn LogicMetaprogramming#If
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Metaprogramming implication.
     *
     * @signature If<TCondition, TResultTrue, TResultFalse>::Type
     *
     * @tparam TCondition The condition.
     * @tparam TResultTrue Result if TCondition evaluates to <tt>True</tt>.
     * @tparam TResultFalse Result if TCondition evaluates to <tt>False</tt>.
     *
     * @return Type The resulting type.
     *
     * @section Example
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code using If.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type if
     *
     *
     *
     * @mfn LogicMetaprogramming#IfC
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Metaprogramming boolean, implication.
     *
     * @signature If<CONDITION, TResultTrue, TResultFalse>::Type
     *
     * @tparam CONDITION The condition, <tt>bool</tt>.
     * @tparam TResultTrue Result if TCondition evaluates to <tt>True</tt>.
     * @tparam TResultFalse Result if TCondition evaluates to <tt>False</tt>.
     *
     * @return Type The resulting type.
     *
     * @section Example
     *
     * We define the following two helper functions.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp true false print helpers
     *
     * Now, we can write the following code using If.
     *
     * @snippet demos/dox/basic/metaprogramming_logic.cpp print bool type if
     */