}
}
operator tvm::runtime::String() const {
- // directly use the std::string constructor for now.
- return tvm::runtime::String(operator std::string());
+ if (IsObjectRef<tvm::runtime::String>()) {
+ return AsObjectRef<tvm::runtime::String>();
+ } else {
+ return tvm::runtime::String(operator std::string());
+ }
}
operator DLDataType() const {
if (type_code_ == kTVMStr) {
return *ptr<std::string>();
}
operator tvm::runtime::String() const {
- // directly use the std::string constructor for now.
- return tvm::runtime::String(operator std::string());
+ if (IsObjectRef<tvm::runtime::String>()) {
+ return AsObjectRef<tvm::runtime::String>();
+ } else {
+ return tvm::runtime::String(operator std::string());
+ }
}
operator DLDataType() const {
if (type_code_ == kTVMStr) {
CHECK(y == "hello");
*rv = x;
})("hello");
+
+ PackedFunc([&](TVMArgs args, TVMRetValue* rv) {
+ CHECK(args.num_args == 1);
+ runtime::String s = args[0];
+ CHECK(s == "hello");
+ })(runtime::String("hello"));
}