pdxcodemonkey commented on a change in pull request #625:
URL: https://github.com/apache/geode-native/pull/625#discussion_r453936057



##########
File path: cppcache/include/geode/DataInput.hpp
##########
@@ -313,7 +313,53 @@ class APACHE_GEODE_EXPORT DataInput {
         // empty string
         break;
       // TODO: What's the right response here?
-      default:
+      case internal::DSCode::FixedIDDefault:

Review comment:
       Just gonna leave this here, cause I spent the time & effort to figure it 
out.  Probably slightly better performance than the if-else approach, but I'm 
still not sure about readability:
   
   ```
     template <class CharT = char, class... Tail>
     inline std::basic_string<CharT, Tail...> readString() {
       std::basic_string<CharT, Tail...> value;
       std::map<internal::DSCode, std::function<void(std::string&)> > readers;
   
       readers.insert(std::make_pair(
           internal::DSCode::CacheableString,
           [=](std::string& val) { this->readJavaModifiedUtf8(val); }));
   
       readers.insert(
           std::make_pair(internal::DSCode::CacheableStringHuge,
                          [=](std::string& val) { this->readUtf16Huge(val); }));
   
       readers.insert(
           std::make_pair(internal::DSCode::CacheableASCIIString,
                          [=](std::string& val) { this->readAscii(val); }));
   
       readers.insert(
           std::make_pair(internal::DSCode::CacheableASCIIStringHuge,
                          [=](std::string& val) { this->readAsciiHuge(val); }));
   
       auto type = static_cast<internal::DSCode>(read());
       auto it = readers.find(static_cast<internal::DSCode>(read()));
   
       if (it != readers.end()) {
         it->second(value);
       }
       return value;
     }
   
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to