一个经典的用法:
#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中居然无法编译通过~  郁闷了.

解决方案 »

  1.   

    露掉些代码
    void main() {
             test1();
    }
      

  2.   

    感谢 DentistryDoctor(MVP-My heart will fly,in the sky.) 的回答.我想用它的显式模板实例化. 
    其实我的问题是,在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++中可编译通过}