4 All constructs in GIL are models of GIL concepts. A *concept* is a set of
5 requirements that a type (or a set of related types) must fulfill to be used
6 correctly in generic algorithms. The requirements include syntactic and
7 algorithmic guarantees. For example, GIL class ``pixel`` is a model of GIL
8 ``PixelConcept``. The user may substitute the pixel class with one of their
9 own, and, as long as it satisfies the requirements of ``PixelConcept``,
10 all other GIL classes and algorithms can be used with it.
11 See more about concepts is avaialble at
12 `Generic Programming in ConceptC++ <https://web.archive.org/web/20160324115943/http://www.generic-programming.org/languages/conceptcpp/>`_
14 In this document we will use a syntax for defining concepts that is described
15 in the C++ standard proposal paper
16 `[N2081] Concepts <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2081.pdf>`_.
18 Here are some common concepts that will be used in GIL.
19 Most of them are defined at the
20 `ConceptC++ Concept Web <https://web.archive.org/web/20160326060858/http://www.generic-programming.org/languages/conceptcpp/concept_web.php>`_:
24 auto concept DefaultConstructible<typename T>
29 auto concept CopyConstructible<typename T>
35 auto concept Assignable<typename T, typename U = T>
38 result_type operator=(T&, U);
41 auto concept EqualityComparable<typename T, typename U = T>
43 bool operator==(T x, T y);
44 bool operator!=(T x, T y) { return !(x==y); }
47 concept SameType<typename T, typename U> { /* unspecified */ };
48 template<typename T> concept_map SameType<T, T> { /* unspecified */ };
50 auto concept Swappable<typename T>
52 void swap(T& t, T& u);
55 Here are some additional basic concepts that GIL needs:
59 auto concept Regular<typename T> :
60 DefaultConstructible<T>,
62 EqualityComparable<T>,
67 auto concept Metafunction<typename T>