Library 1

Lib. 1: bugfix
Lib. 2: added container from Lib. 1
This commit is contained in:
Alessandro Ferro
2021-04-11 11:01:37 +02:00
parent 2941c1d298
commit 04acfaf125
3 changed files with 66 additions and 105 deletions

16
librerie/exercise2/container/container.cpp Executable file → Normal file
View File

@@ -1,10 +1,18 @@
namespace lasd {
/* ************************************************************************** */
template <typename Data>
void AuxFoldExists(const Data& dat, const void* val, void* exists){
if(dat == *((Data*)val)){
*((bool*)exists) = true;
}
}
// ...
/* ************************************************************************** */
template <typename Data>
bool FoldableContainer<Data>::Exists(const Data& dat) const noexcept{
bool exists = false;
FoldPreOrder(&AuxFoldExists<Data>, &dat, &exists);
return exists;
}
}