tqchen commented on issue #4628: [Object] Add String container
URL: https://github.com/apache/incubator-tvm/pull/4628#issuecomment-583765522
 
 
   
   @wweic here is an code snippet that we can reuse for hash. We should 
consider migrate to require c++14, which will give us string view support
   
   ```
   #define TVM_USE_CXX14_STRING_VIEW                                       \
     defined(__cpp_lib_experimental_string_view) && 
__cpp_lib_experimental_string_view >= 201411
   
   #define TVM_USE_CXX17_STRING_VIEW                                       \
     defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606
   
   #include <string>
   #include <dmlc/logging.h>
   
   #if TVM_USE_CXX17_STRING_VIEW
   #include <string_view>
   #elif TVM_USE_CXX14_STRING_VIEW
   #include <experimental/string_view>
   #endif
   
   int main(int argc, char* argv[]) {
     std::string xyz = "xyz";
   
   #if TVM_USE_CXX17_STRING_VIEW
     LOG(INFO) << "C++17=" << std::hash<std::string_view>()(xyz);
   #elif TVM_USE_CXX14_STRING_VIEW
     LOG(INFO) << "C++14=" << std::hash<std::experimental::string_view>()(xyz);
   #else
     LOG(INFO) << "C++11=" << std::hash<std::string>()(xyz);
   #endif
     return 0;
   }
   
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to