ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
SetOperations.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*-------------------------- File SetOperations.h --------------------------*/
3
/*--------------------------------------------------------------------------*/
31
/*--------------------------------------------------------------------------*/
32
/*----------------------------- DEFINITIONS --------------------------------*/
33
/*--------------------------------------------------------------------------*/
34
35
#ifndef __ADS_SetOperations
36
#define __ADS_SetOperations
37
/* self-identification: #endif constant */
38
39
/*--------------------------------------------------------------------------*/
40
/*------------------------------ INCLUDES ----------------------------------*/
41
/*--------------------------------------------------------------------------*/
42
43
#include "
ADS/ADT.h
"
44
#include "
ADS/Contract.h
"
45
46
#include <algorithm>
47
#include <concepts>
48
#include <cstddef>
49
#include <functional>
50
#include <optional>
51
#include <stdexcept>
52
#include <utility>
53
#include <vector>
54
55
/*--------------------------------------------------------------------------*/
56
/*--------------------------- NAMESPACE ------------------------------------*/
57
/*--------------------------------------------------------------------------*/
58
59
namespace
ADS
60
{
61
62
/*--------------------------------------------------------------------------*/
63
/*--------------------------- GENERIC OPERATIONS ---------------------------*/
64
/*--------------------------------------------------------------------------*/
65
67
template
<
class
S >
68
concept
IterableSet
=
69
Set< S >
&& std::copy_constructible< S > &&
70
requires
(
const
S s )
71
{ s.forEach( [](
const
typename
S::Item & ) { } ); };
72
85
template
< IterableSet S >
86
S
setUnion
(
const
S & A ,
const
S & B );
87
103
template
< IterableSet S >
104
S
setIntersection
(
const
S & A ,
const
S & B );
105
118
template
< IterableSet S >
119
S
setDifference
(
const
S & A ,
const
S & B );
120
135
template
< IterableSet S >
136
S
setSymmetricDifference
(
const
S & A ,
const
S & B );
137
138
namespace
detail
139
{
140
147
template
<
class
C ,
class
A ,
class
B >
148
bool
isSetOperation(
const
C & c ,
const
A & a ,
const
B & b ,
char
op );
149
150
}
// end( namespace detail )
151
152
}
// end( namespace ADS )
153
154
/*--------------------------------------------------------------------------*/
155
/*-------------------------- IMPLEMENTATION --------------------------------*/
156
/*--------------------------------------------------------------------------*/
157
158
#include "ADS/set/impl/SetOperations.tpp"
159
160
/*--------------------------------------------------------------------------*/
161
162
#endif
/* SetOperations.h included */
163
164
/*--------------------------------------------------------------------------*/
165
/*------------------------ End File SetOperations.h ------------------------*/
166
/*--------------------------------------------------------------------------*/
ADT.h
The abstract data types of the book, as concepts of C++20: SEQUENCE, SET and DICTIONARY (chapter 3),...
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::IterableSet
a SET that can be copied and has the foreach
Definition
SetOperations.h:68
ADS::Set
SET (section 3.2.2): a finite collection of distinct items; union(), intersection() and difference() ...
Definition
ADT.h:140
ADS::setIntersection
BoolSet setIntersection(const BoolSet &A, const BoolSet &B)
the intersection, a set of dimension
ADS::setUnion
BoolSet setUnion(const BoolSet &A, const BoolSet &B)
the union, a set of dimension
ADS::setDifference
BoolSet setDifference(const BoolSet &A, const BoolSet &B)
the difference, a set of dimension A.dim()
ADS::setSymmetricDifference
BoolSet setSymmetricDifference(const BoolSet &A, const BoolSet &B)
the symmetric difference, the items in exactly one of and , a set of dimension
ADS
Definition
ADT.h:96
ADS
set
SetOperations.h
Generated by
1.17.0