فهرست منبع

refactor: use string_view instead of string for from_string for ease-of-user

Sam Jaffe 2 سال پیش
والد
کامیت
8cb0538fd3
2فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 2 1
      include/serializer/jsonizer.h
  2. 1 1
      include/serializer/jsonizer_ios.tpp

+ 2 - 1
include/serializer/jsonizer.h

@@ -50,7 +50,8 @@ public:
    * @return A newly constructed object by value
    */
   template <typename T> T from_stream(std::istream & in) const;
-  template <typename T> T from_string(std::string const & in) const;
+  template <typename T> T from_string(std::string_view in) const;
+
   /**
    * @brief Write an object out to a datastream, such as std::cout or a file
    * @param T the input type to be serialized

+ 1 - 1
include/serializer/jsonizer_ios.tpp

@@ -25,7 +25,7 @@ template <typename T> T Jsonizer::from_stream(std::istream & in) const {
   return from_json<T>(root);
 }
 
-template <typename T> T Jsonizer::from_string(std::string const & in) const {
+template <typename T> T Jsonizer::from_string(std::string_view in) const {
   std::stringstream ss;
   ss << in;
   return from_stream<T>(ss);