一个经典的用法:
#include <iostream>
#include <string>
#include <bitset>
using namespace std;void test1() {
bitset<8> b(3);
string s=b.template to_string<char,
std::char_traits<char>,
std::allocator<char> >();
cout<<s<<endl;
}
//~在vc6中居然无法编译通过~ 郁闷了.
#include <iostream>
#include <string>
#include <bitset>
using namespace std;void test1() {
bitset<8> b(3);
string s=b.template to_string<char,
std::char_traits<char>,
std::allocator<char> >();
cout<<s<<endl;
}
//~在vc6中居然无法编译通过~ 郁闷了.
解决方案 »
- CDC的m_hDC是通常我们说的设备句柄,那么m_hAttribDC通常是用在什么情形?
- 求vfw.lib文件
- 怎样获得图标?(包括获得不包含图标资源的文件显示在屏幕上的图标)
- 为何给ListBox发送LB_SETITEMDATA都没有成功呢?
- 如何在控制台程序中将输入的用户名和密码不显示在屏幕上?
- 子控件SubClassWindow()到父对话框的问题?
- 为MFC规则DLL中生成一个ADO的数据连接。为什么会有如下问题??谢谢大家
- 愿意著书的优秀编程人员的请回复
- 程序崩溃的问题
- $$$请教关于子程序调用机制,送分!!!!
- Visual Assist怎样使用啊?
- 我该怎么搞他?虽然只有3行代码
void main() {
test1();
}
其实我的问题是,在vc6中,如何对一个模板成员函数进行特定的实例化.比如:
class Test {
public:
template <class R,class T> R go(T p1) {
cout<<p1<<endl;
return R();
}
};void main() {
Test t;
t.go(1); //这样调用是错误的
t.go<int,int>(1); //vc6中这样调用也是错误的,g++中可编译通过}