类模版实例化有关问题(STL)

类模版实例化问题(STL)
相关定义:

template <   class   char_type,   class   traits_type   >
        class   basic_message_handler_log
                :   public   std::basic_ostream <   char_type,   traits_type>
{...}

template <   class   char_type,   class   traits_type>
        class   basic_thread_safe_log
        //   ***   protected,   not   public   !!!
        :   protected   basic_message_handler_log <   char_type,   traits_type>
{...}

typedef   basic_thread_safe_log <   char>   thread_safe_log;

//   根据数字取得字符串
template <   int   idxLog>   std::string   get_out_name(
                bool   bIsSharedLog,
                int_to_type <   idxLog>   *   =   NULL   /*   workaround   for   VC6   bug   */)
{
        std::ostringstream   out;
        out   < <   "out "   < <   (bIsSharedLog   ?   "sharedthread "   :   "ownthread ")
                < <   idxLog   < <   ".txt ";
        return   out.str();
}


在VS   2005下:
如下代码可以编译通过:
1、
template <   class   char_type,   class   traits_type>
basic_thread_safe_log <     char_type,   traits_type>
get_log_sharedthread()
{      
const   basic_string <     char_type,   traits_type>   &   strFileName;
static   std::ofstream   out(   strFileName   );        
static   internal_thread_safe_log_sharethread   log(   out,   get_ts_writer(),   1);        
return   basic_thread_safe_log <     char_type,   traits_type> (   log);
}    

2、
template <   int   idxLog>   thread_safe_log   templ_get_log_sharedthread(int_to_type <   idxLog>   *   =   NULL   /*   workaround   for   VC6   bug   */)
{        
        static   std::ofstream   out(   get_out_name <   idxLog> (   true).c_str()   );        
        static   internal_thread_safe_log_sharethread   log(   out,   get_ts_writer(),   10   *   (   idxLog   +   1)   *   (   idxLog   +   1));        
        return   thread_safe_log(   log);
}    

如下代码编译失败:
thread_safe_log   get_log_sharedthread(const   string   &   strFileName)
{        
static   std::ofstream   out(   strFileName   );        
static   internal_thread_safe_log_sharethread   log(   out,   get_ts_writer(),   1);        
return   thread_safe_log(   log);
}    

请问为何?
如何修改使编译失败的代码能够通过编译?