geode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pivotal-jbarrett <...@git.apache.org>
Subject [GitHub] geode-native pull request #107: GEODE-3019: Refactor Struct class
Date Thu, 13 Jul 2017 17:23:16 GMT
Github user pivotal-jbarrett commented on a diff in the pull request:

    https://github.com/apache/geode-native/pull/107#discussion_r127278631
  
    --- Diff: src/cppcache/src/StructSetImpl.cpp ---
    @@ -78,13 +78,12 @@ int32_t StructSetImpl::getFieldIndex(const char* fieldname) {
       }
     }
     
    -const char* StructSetImpl::getFieldName(int32_t index) {
    -  for (std::map<std::string, int32_t>::iterator iter =
    -           m_fieldNameIndexMap.begin();
    -       iter != m_fieldNameIndexMap.end(); ++iter) {
    -    if (iter->second == index) return iter->first.c_str();
    +const std::string& StructSetImpl::getFieldName(int32_t index) {
    +  for (const auto& iter : m_fieldNameIndexMap) {
    +    if (iter.second == index) return (iter.first);
       }
    -  return nullptr;
    +
    +  throw OutOfRangeException("Struct: fieldName not found.");
    --- End diff --
    
    why not `std::out_of_range`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message