Concepts ======== All constructs in GIL are models of GIL concepts. A *concept* is a set of requirements that a type (or a set of related types) must fulfill to be used correctly in generic algorithms. The requirements include syntactic and algorithmic guarantees. For example, GIL class ``pixel`` is a model of GIL ``PixelConcept``. The user may substitute the pixel class with one of their own, and, as long as it satisfies the requirements of ``PixelConcept``, all other GIL classes and algorithms can be used with it. See more about concepts is avaialble at `Generic Programming in ConceptC++ `_ In this document we will use a syntax for defining concepts that is described in the C++ standard proposal paper `[N2081] Concepts `_. Here are some common concepts that will be used in GIL. Most of them are defined at the `ConceptC++ Concept Web `_: .. code-block:: cpp auto concept DefaultConstructible { T::T(); }; auto concept CopyConstructible { T::T(T); T::~T(); }; auto concept Assignable { typename result_type; result_type operator=(T&, U); }; auto concept EqualityComparable { bool operator==(T x, U y); bool operator!=(T x, U y) { return !(x==y); } }; concept SameType { /* unspecified */ }; template concept_map SameType { /* unspecified */ }; auto concept Swappable { void swap(T& t, T& u); }; Here are some additional basic concepts that GIL needs: .. code-block:: cpp auto concept Regular : DefaultConstructible, CopyConstructible, EqualityComparable, Assignable, Swappable {}; auto concept Metafunction { typename type; };