我想知道是否有继承模板函数的模式/方法?模板函数不能是虚拟的,因此如果我的基类有模板函数并且我的派生类也有相同的模板函数,则在以下示例中将始终调用基类的函数:
struct Base {
Base() {}
template < typename T >
void do_something(T& t) const {
t << "Base" << std::endl ;
}
};
struct Foo : Base {
Foo() : Base () {}
template < typename T >
void do_something(T& t) const {
t << "Foo" << std::endl ;
}
};
struct Bar : Foo {
Bar() : Foo() {}
template < typename T >
void do_something(T& t) const {
t << "Bar" << std::endl ;
}
};
int …
Run Code Online (Sandbox Code Playgroud) 根据定义,单个程序的多个线程共享它们的工作目录。您是否知道是否可以将每个线程都放在专用的工作目录中?也许是一个特定的图书馆?
注意:目标语言是c ++