1
1

jsonPrimitive.hh 516 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <string>
  3. #include "jsonElement.hh"
  4. template <typename T>
  5. class JSonPrimitive: public JSonElement
  6. {
  7. public:
  8. JSonPrimitive(T const &v);
  9. virtual ~JSonPrimitive();
  10. bool operator<(const JSonPrimitive<T> &other) const;
  11. protected:
  12. const T value;
  13. };
  14. template<typename T>
  15. JSonPrimitive<T>::JSonPrimitive(T const &v): value(v)
  16. { }
  17. template<typename T>
  18. bool JSonPrimitive<T>::operator<(const JSonPrimitive<T> &other) const
  19. {
  20. return value < other.value;
  21. }