aglargilwangz's recent timeline updates
aglargilwangz

aglargilwangz

V2EX member #436823, joined on 2019-08-19 16:01:12 +08:00
Per aglargilwangz's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
aglargilwangz's recent replies
支持支持
[email protected] 大佬求个 lifetime!
Aug 11, 2023
Replied to a topic by iqoo 程序员 关于 C++ 模板一个问题
```cpp
#include <iostream>

struct Base {
void print() {
std::cout << "Base class\n";
}
};

struct Str : Base {
Str(const char* s) {}
void print() {
std::cout << "String class\n";
}
};

struct Num : Base {
Num(int v) {}
void print() {
std::cout << "Number class\n";
}
};

template<typename T>
struct Mapper;

template<>
struct Mapper<const char*> {
using type = Str;
};

template<>
struct Mapper<int> {
using type = Num;
};

template<typename T>
void log(T obj) {
typename Mapper<T>::type mappedObj(obj);
mappedObj.print();
}

int main() {
log("hello");
log(123);
}
```
请问有应届的招聘吗
hi,楼主,我也有跟你类似的想法,方便加个联系方式细聊吗
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5600 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 30ms · UTC 03:32 · PVG 11:32 · LAX 20:32 · JFK 23:32
♥ Do have faith in what you're doing.