第29435题 单选题
针对如下C++模板结构体代码,下列说法正确的是?
#include <iostream>
#include <string>

template<typename T>
struct MyStruct {
    T val;
    MyStruct(T v) : val(v) {}
    T getVal() { return val; }
};

// 针对std::string的全特化版本
template<>
struct MyStruct<std::string> {
    std::string val;
    MyStruct(std::string v) : val("prefix_" + v) {}
    std::string getVal() { return val; }
};
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析