File: erasedup.yo

package info (click to toggle)
c%2B%2B-annotations 13.02.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,576 kB
  • sloc: cpp: 25,297; makefile: 1,523; ansic: 165; sh: 126; perl: 90; fortran: 27
file content (30 lines) | stat: -rw-r--r-- 1,583 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
To remove all duplicates from a tt(TypeList) all the tt(TypeList)'s first
elements must be erased from the tt(TypeList)'s tail, applying the procedure
recursively to the tt(TypeList)'s tail. The algorithm, outlined below, merely
expects a tt(TypeList):
    itemization(
    it() First, the generic tt(EraseDup) struct template is
declared. tt(EraseDup) structures define a type tt(List) representing the
tt(TypeList) that they generate. tt(EraseDup) calls expect a tt(TypeList) as
their template type parameters:
        verbinclude(//ERASEDUP examples/erase.h)
    it() If the tt(TypeList) is empty it can be returned empty and we're done:
        verbinclude(//ERASEDUPEMPTY examples/erase.h)
    it() In all other cases
        itemization(
        it() tt(EraseDup) is first applied to the original tt(TypeList)'s
tail. By definition this results in a tt(TypeList) from which all
duplicates have been removed;
        it() The tt(TypeList) returned by the previous step might contain the
original tt(TypeList)'s initial type. If so, it is removed by applying
tt(Erase) on the returned tt(TypeList), specifying the original tt(TypeList)'s
initial type as the type to remove;
        it() The returned tt(TypeList) consists of the original tt(TypeList)'s
initial type to which the types of the tt(TypeList) produced by the previous
step are appended.
        )
    This specialization is implemented like this:
        verbinclude(//ERASEDUPHEAD examples/erase.h)
    )
    Here is an example showing how tt(EraseDup) can be used:
        verbinclude(//ERASEDUP examples/erase.cc)