Advertisement
Guest User

Untitled

a guest
May 27th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. /*
  2. YOU HAVE TO EDIT THIS FILE
  3. */
  4.  
  5. #include "MaxValue.h"
  6. #include <algorithm>
  7. std::vector<int> MaxValue::s_Values;
  8.  
  9. MaxValue::MaxValue( int value )
  10. {
  11. m_Value = s_Values.size();
  12. s_Values.push_back(value);
  13. }
  14.  
  15. MaxValue::~MaxValue()
  16. {
  17. s_Values[m_Value] = 0;
  18. }
  19.  
  20. int MaxValue::CurrentMaximum()
  21. {
  22. if (s_Values.size()>0)
  23. {
  24. return *std::max_element(s_Values.begin(), s_Values.end());
  25. }
  26. }
  27.  
  28. MaxValue::MaxValue(const MaxValue& other)
  29. {
  30. m_Value = s_Values.size();
  31. s_Values.push_back(s_Values[other.m_Value]);
  32. }
  33. MaxValue& MaxValue::operator=(MaxValue other)
  34. {
  35. s_Values[m_Value] = s_Values[other.m_Value];
  36. return *this;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement