#include <iostream>
#include <iostream>
template <typename Tip>
class Skup{
std::vector<Tip> elementi;
public:
Skup() {}
Skup(initializer_list<Tip> lista);
int Velicina() const {return elementi.size()}
void Dodaj(const Tip &element);
void Izbrisi(const Tip &element);
bool ImaLiGa(const Tip &element) const;
void Ispisi()const;
bool operator ==(const Skup &s) const{ return elementi == s.elementi;}
bool operator !=(const Skup &s) const{ return !(*this == s);}
bool operator <(const Skup &s) const{ return *this <= s && *this != s;}
bool operator <=(const Skup &s) const{
for(const Tip &element : elementi)
if(s.ImaLiGa(element)) return false;
return true;
}
bool operator >(const Skup &s) const{ return s < *this;}
bool operator >=(const Skup &s) const{ return s <= *this;}
};
template <typename Tip>
Skup<Tip>::Skup(initializer_list<Tip>lista){
for(auto x : lista) Dodaj(x);
}
template<typename Tip>
void Skup<Tip>::Dodaj(const Tip &element){
if(ImaLiGa(element)) return;
elementi.push_back(element);
std::sort(element.begin(), element.end());
}
template <typename Tip>
void Skup<Tip>::Izbrisi(const Tip &element){
auto it=std::find(elementi.begin(), elementi.end(), element);
if(it!=elementi.end()) elementi.erase(it);
}
template<typename Tip>
bool Skup<Tip>::ImaLiGa(const Tip &element) const{
return std::binary_search(elementi.begin(), elementi.end(), element);
}
template <typename Tip>
void Skup<Tip>::Ispisi() const {
for(auto x : elementi) std::cout << x << " ";
}
int main() {
std::cout << "Hello world!" << std::endl;
return 0;
}
int main() {
std::cout << "Hello world!" << std::endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: