summaryrefslogtreecommitdiffstats
path: root/src/ml/dlib/dlib/set_utils/set_utils_abstract.h
blob: e1eba6afc9535ccd5d6f90811adbe4aeb1a0a7a9 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Copyright (C) 2007  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#undef DLIB_SET_UTILs_ABSTRACT_
#ifdef DLIB_SET_UTILs_ABSTRACT_

#include "../set.h"
#include "../algs.h"

namespace dlib
{

// ----------------------------------------------------------------------------------------

    template <
        typename T,
        typename U
        >
    unsigned long set_intersection_size (
        const T& a,
        const U& b
    );
    /*!
        requires
            - T and U must both be implementations of set/set_kernel_abstract.h
        ensures
            - returns the number of elements that are in both set a and b
    !*/

// ----------------------------------------------------------------------------------------

    template <
        typename T,
        typename U,
        typename V
        >
    void set_union (
        const T& a,
        const U& b,
        V& u
    );
    /*!
        requires
            - T, U, and V must all be implementations of set/set_kernel_abstract.h
            - the types of objects contained in these sets must be copyable
        ensures
            - #u == the union of a and b.  That is, u contains all elements 
              of a and all the elements of b.
    !*/

// ----------------------------------------------------------------------------------------

    template <
        typename T,
        typename U,
        typename V
        >
    void set_intersection (
        const T& a,
        const U& b,
        V& i
    );
    /*!
        requires
            - T, U, and V must all be implementations of set/set_kernel_abstract.h
            - the types of objects contained in these sets must be copyable
        ensures
            - #i == the intersection of a and b.  That is, i contains all elements 
              of a that are also in b.
    !*/

// ----------------------------------------------------------------------------------------

    template <
        typename T,
        typename U,
        typename V
        >
    void set_difference (
        const T& a,
        const U& b,
        V& d 
    );
    /*!
        requires
            - T, U, and V must all be implementations of set/set_kernel_abstract.h
            - the types of objects contained in these sets must be copyable
        ensures
            - #d == the difference of a and b.  That is, d contains all elements 
              of a that are NOT in b.
    !*/

// ----------------------------------------------------------------------------------------

}

#endif // DLIB_SET_UTILs_ABSTRACT_