Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <list>
- template<typename T>
- std::list<T> SinSegunda(std::list<T> a, std::list<T> b) {
- std::list<T> nueva_lista;
- typename std::list<T>::iterator it_a = a.begin();
- typename std::list<T>::iterator it_b;
- bool esta;
- while ( it_a != a.end() ) {
- esta = false;
- it_b = b.begin();
- while ( it_b != b.end() ) {
- if (*it_a == *it_b) {
- esta = true;
- break;
- }
- ++it_b;
- }
- if (!esta) {
- nueva_lista.push_back(*it_a);
- }
- ++it_a;
- }
- return nueva_lista;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement