# t00056 - Basic C++20 concepts test case
## Config
```yaml
compilation_database_dir: ..
output_directory: puml
diagrams:
  t00056_class:
    type: class
    glob:
      - ../../tests/t00056/t00056.cc
    include:
      namespaces:
        - clanguml::t00056
    using_namespace:
      - clanguml::t00056
```
## Source code
File t00056.cc
```cpp
#include <string>

namespace clanguml {
namespace t00056 {

template <typename T, typename L>
concept greater_than_simple = sizeof(T) > sizeof(L);

template <typename T, typename P>
concept greater_than_with_requires =
    requires(T l, P r) { sizeof(l) > sizeof(r); };

// Constraint expression
template <typename T>
concept max_four_bytes = sizeof(T) <= 4;

// Simple requirement
template <typename T>
concept iterable = requires(T container) {
                       container.begin();
                       container.end();
                   };

// Type requirement
template <typename T>
concept has_value_type = requires { typename T::value_type; };

template <typename T>
concept convertible_to_string =
    max_four_bytes<T> && requires(T s) {
                             std::string{s};
                             {
                                 std::to_string(s)
                             } noexcept;
                             {
                                 std::to_string(s)
                                 } -> std::same_as<std::string>;
                         };

// Compound requirement
// ...

// Combined concept
template <typename T>
concept iterable_with_value_type = iterable<T> && has_value_type<T>;

template <typename T>
concept iterable_or_small_value_type =
    iterable_with_value_type<T> || max_four_bytes<T>;

// Simple type constraint
template <max_four_bytes T> struct A {
    T a;
};

// Requires constant expression
template <typename T>
    requires iterable_or_small_value_type<T>
struct B {
    T b;
};

// Anonymous concept requirement (TODO)
template <convertible_to_string T>
    requires requires(T t) {
                 --t;
                 t--;
             }
struct C {
    T c;
};

template <iterable T1, typename T2, iterable T3, typename T4, typename T5>
    requires max_four_bytes<T2> && max_four_bytes<T5>
struct D { };

template <typename T1, typename T2, typename T3>
    requires greater_than_with_requires<T1, T3>
struct E {
    T1 e1;
    T2 e2;
    T3 e3;
};

template <typename T1, typename T2, typename T3>
    requires greater_than_simple<T1, T3>
struct F {
    T1 f1;
    T2 f2;
    T3 f3;
};
}
}
```
## Generated UML diagrams
![t00056_class](./t00056_class.svg "Basic C++20 concepts test case")
## Generated JSON models
```json
{
  "diagram_type": "class",
  "elements": [
    {
      "display_name": "clanguml::t00056::greater_than_simple<T,L>",
      "id": "902541696362244204",
      "name": "greater_than_simple",
      "namespace": "clanguml::t00056",
      "parameters": [],
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 7
      },
      "statements": [],
      "type": "concept"
    },
    {
      "display_name": "clanguml::t00056::greater_than_with_requires<T,P>",
      "id": "1830716585637735576",
      "name": "greater_than_with_requires",
      "namespace": "clanguml::t00056",
      "parameters": [
        {
          "name": "clanguml::t00056::l",
          "type": "T"
        },
        {
          "name": "clanguml::t00056::r",
          "type": "P"
        }
      ],
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 10
      },
      "statements": [
        "sizeof (l) > sizeof (r)"
      ],
      "type": "concept"
    },
    {
      "display_name": "clanguml::t00056::max_four_bytes<T>",
      "id": "385255522691733325",
      "name": "max_four_bytes",
      "namespace": "clanguml::t00056",
      "parameters": [],
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 15
      },
      "statements": [],
      "type": "concept"
    },
    {
      "display_name": "clanguml::t00056::iterable<T>",
      "id": "392540961352249242",
      "name": "iterable",
      "namespace": "clanguml::t00056",
      "parameters": [
        {
          "name": "clanguml::t00056::container",
          "type": "T"
        }
      ],
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 19
      },
      "statements": [
        "container.begin()",
        "container.end()"
      ],
      "type": "concept"
    },
    {
      "display_name": "clanguml::t00056::has_value_type<T>",
      "id": "1850394311226276678",
      "name": "has_value_type",
      "namespace": "clanguml::t00056",
      "parameters": [],
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 26
      },
      "statements": [
        "typename T::value_type"
      ],
      "type": "concept"
    },
    {
      "display_name": "clanguml::t00056::convertible_to_string<T>",
      "id": "137304962071054497",
      "name": "convertible_to_string",
      "namespace": "clanguml::t00056",
      "parameters": [
        {
          "name": "clanguml::t00056::s",
          "type": "T"
        }
      ],
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 29
      },
      "statements": [
        "std::string{s}",
        "{std::to_string(s)} noexcept",
        "{std::to_string(s)} -> std::same_as<std::string>"
      ],
      "type": "concept"
    },
    {
      "display_name": "clanguml::t00056::iterable_with_value_type<T>",
      "id": "1043398062146751019",
      "name": "iterable_with_value_type",
      "namespace": "clanguml::t00056",
      "parameters": [],
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 45
      },
      "statements": [],
      "type": "concept"
    },
    {
      "display_name": "clanguml::t00056::iterable_or_small_value_type<T>",
      "id": "866345615551223718",
      "name": "iterable_or_small_value_type",
      "namespace": "clanguml::t00056",
      "parameters": [],
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 48
      },
      "statements": [],
      "type": "concept"
    },
    {
      "bases": [],
      "display_name": "clanguml::t00056::A<clanguml::t00056::max_four_bytes T>",
      "id": "1418333499545421661",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": true,
      "is_template": true,
      "is_union": false,
      "members": [
        {
          "access": "public",
          "is_static": false,
          "name": "a",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 53
          },
          "type": "T"
        }
      ],
      "methods": [],
      "name": "A",
      "namespace": "clanguml::t00056",
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 52
      },
      "template_parameters": [
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T",
          "template_parameters": []
        }
      ],
      "type": "class"
    },
    {
      "bases": [],
      "display_name": "clanguml::t00056::B<T>",
      "id": "1814355496814977880",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": true,
      "is_template": true,
      "is_union": false,
      "members": [
        {
          "access": "public",
          "is_static": false,
          "name": "b",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 60
          },
          "type": "T"
        }
      ],
      "methods": [],
      "name": "B",
      "namespace": "clanguml::t00056",
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 59
      },
      "template_parameters": [
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T",
          "template_parameters": []
        }
      ],
      "type": "class"
    },
    {
      "bases": [],
      "display_name": "clanguml::t00056::C<clanguml::t00056::convertible_to_string T>",
      "id": "1512618198241549089",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": true,
      "is_template": true,
      "is_union": false,
      "members": [
        {
          "access": "public",
          "is_static": false,
          "name": "c",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 70
          },
          "type": "T"
        }
      ],
      "methods": [],
      "name": "C",
      "namespace": "clanguml::t00056",
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 69
      },
      "template_parameters": [
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T",
          "template_parameters": []
        }
      ],
      "type": "class"
    },
    {
      "bases": [],
      "display_name": "clanguml::t00056::D<clanguml::t00056::iterable T1,T2,clanguml::t00056::iterable T3,T4,T5>",
      "id": "1635109601630198093",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": true,
      "is_template": true,
      "is_union": false,
      "members": [],
      "methods": [],
      "name": "D",
      "namespace": "clanguml::t00056",
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 75
      },
      "template_parameters": [
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T1",
          "template_parameters": []
        },
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T2",
          "template_parameters": []
        },
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T3",
          "template_parameters": []
        },
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T4",
          "template_parameters": []
        },
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T5",
          "template_parameters": []
        }
      ],
      "type": "class"
    },
    {
      "bases": [],
      "display_name": "clanguml::t00056::E<T1,T2,T3>",
      "id": "1429225801945621089",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": true,
      "is_template": true,
      "is_union": false,
      "members": [
        {
          "access": "public",
          "is_static": false,
          "name": "e1",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 80
          },
          "type": "T1"
        },
        {
          "access": "public",
          "is_static": false,
          "name": "e2",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 81
          },
          "type": "T2"
        },
        {
          "access": "public",
          "is_static": false,
          "name": "e3",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 82
          },
          "type": "T3"
        }
      ],
      "methods": [],
      "name": "E",
      "namespace": "clanguml::t00056",
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 79
      },
      "template_parameters": [
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T1",
          "template_parameters": []
        },
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T2",
          "template_parameters": []
        },
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T3",
          "template_parameters": []
        }
      ],
      "type": "class"
    },
    {
      "bases": [],
      "display_name": "clanguml::t00056::F<T1,T2,T3>",
      "id": "856301122972546034",
      "is_abstract": false,
      "is_nested": false,
      "is_struct": true,
      "is_template": true,
      "is_union": false,
      "members": [
        {
          "access": "public",
          "is_static": false,
          "name": "f1",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 88
          },
          "type": "T1"
        },
        {
          "access": "public",
          "is_static": false,
          "name": "f2",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 89
          },
          "type": "T2"
        },
        {
          "access": "public",
          "is_static": false,
          "name": "f3",
          "source_location": {
            "file": "../../tests/t00056/t00056.cc",
            "line": 90
          },
          "type": "T3"
        }
      ],
      "methods": [],
      "name": "F",
      "namespace": "clanguml::t00056",
      "source_location": {
        "file": "../../tests/t00056/t00056.cc",
        "line": 87
      },
      "template_parameters": [
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T1",
          "template_parameters": []
        },
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T2",
          "template_parameters": []
        },
        {
          "is_variadic": false,
          "kind": "template_type",
          "name": "T3",
          "template_parameters": []
        }
      ],
      "type": "class"
    }
  ],
  "metadata": {
    "clang_uml_version": "0.3.5-27-g81c7ce7",
    "llvm_version": "Ubuntu clang version 15.0.6",
    "schema_version": 1
  },
  "name": "t00056_class",
  "relationships": [
    {
      "destination": "385255522691733325",
      "label": "T",
      "source": "137304962071054497",
      "type": "constraint"
    },
    {
      "destination": "392540961352249242",
      "label": "T",
      "source": "1043398062146751019",
      "type": "constraint"
    },
    {
      "destination": "1850394311226276678",
      "label": "T",
      "source": "1043398062146751019",
      "type": "constraint"
    },
    {
      "destination": "1043398062146751019",
      "label": "T",
      "source": "866345615551223718",
      "type": "constraint"
    },
    {
      "destination": "385255522691733325",
      "label": "T",
      "source": "866345615551223718",
      "type": "constraint"
    },
    {
      "destination": "385255522691733325",
      "label": "T",
      "source": "1418333499545421661",
      "type": "constraint"
    },
    {
      "destination": "866345615551223718",
      "label": "T",
      "source": "1814355496814977880",
      "type": "constraint"
    },
    {
      "destination": "137304962071054497",
      "label": "T",
      "source": "1512618198241549089",
      "type": "constraint"
    },
    {
      "destination": "392540961352249242",
      "label": "T1",
      "source": "1635109601630198093",
      "type": "constraint"
    },
    {
      "destination": "392540961352249242",
      "label": "T3",
      "source": "1635109601630198093",
      "type": "constraint"
    },
    {
      "destination": "385255522691733325",
      "label": "T2",
      "source": "1635109601630198093",
      "type": "constraint"
    },
    {
      "destination": "385255522691733325",
      "label": "T5",
      "source": "1635109601630198093",
      "type": "constraint"
    },
    {
      "destination": "1830716585637735576",
      "label": "T1,T3",
      "source": "1429225801945621089",
      "type": "constraint"
    },
    {
      "destination": "902541696362244204",
      "label": "T1,T3",
      "source": "856301122972546034",
      "type": "constraint"
    }
  ],
  "using_namespace": "clanguml::t00056"
}
```
