fork download
  1. #include <algorithm>
  2. #include <string>
  3. #include <vector>
  4.  
  5. namespace otherns {
  6.  
  7. class Property {
  8. public:
  9. const std::string &getName() const { return m_name; }
  10.  
  11. private:
  12. std::string m_name;
  13. };
  14.  
  15. }
  16.  
  17. namespace otherns {
  18. bool operator==(const otherns::Property &a, const otherns::Property &b) {
  19. return a.getName() == b.getName();
  20. }
  21. }
  22.  
  23. /* Merge, second takes priority */
  24. std::vector<otherns::Property>
  25. merge_props(const std::vector<otherns::Property> &xs,
  26. const std::vector<otherns::Property> &ys) {
  27. std::vector<otherns::Property> ans = ys;
  28. for (const auto &x : xs) {
  29. if (std::find(ans.begin(), ans.end(), x) == ans.end()) {
  30. ans.push_back(x);
  31. }
  32. }
  33. return ans;
  34. }
  35.  
  36.  
  37.  
  38.  
  39. int main(){}
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty