Advertisement
cppgods

ittvan

Jan 28th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #ifndef CONTFIND_H
  2. #define CONTFIND_H
  3. #include <string>
  4. #include <list>
  5. #include <map>
  6.  
  7. template <typename ContainerT/*, typename ValueT = typename ContainerT::value_type*/>
  8. class container_finder
  9. {
  10. private:
  11. std::list<ContainerT*> container;
  12.  
  13. public:
  14. container_finder() {
  15. //this.container.insert(cont);
  16. }
  17.  
  18. container_finder<ContainerT>& add_container(ContainerT &toAdd) {
  19. container.push_back(&toAdd);
  20. return *this;
  21. }
  22.  
  23. ContainerT* which(typename ContainerT::iterator itToFind) {
  24. for(typename std::list<ContainerT*>::iterator it = container.begin(); it != container.end(); it++) {
  25. for(typename ContainerT::iterator it2 = (*it)->begin(); it2 != (*it)->end(); it2++) {
  26. if(it2 == itToFind) {
  27. ContainerT* result = *it;
  28. return result;
  29. }
  30. }
  31. }
  32. return 0;
  33. }
  34.  
  35. void &operator+=(container_finder<ContainerT>& cf, ) {
  36. }
  37. };
  38.  
  39. #endif // CONTFIND_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement