Re: [cpp] my problem(关于函数的默认参数和变量的生存周期)

hoohag hoohag at pset.suntec.net
Mon Mar 3 09:46:16 CST 2008


呵呵, 怎么把CSDN的帖子都转发了啊, 这个问题...恩, 还是直接去看CSDNd的C++论坛比较直接
Regards
jesus.job

  ----- Original Message ----- 
  From: ScottField Koo 
  To: C++ Discuss Group 
  Sent: Sunday, March 02, 2008 1:48 PM
  Subject: Re: [cpp] my problem(关于函数的默认参数和变量的生存周期)


  你这个程序也应该是google出来的吧,我早就看到过了&# 8230;&# 8230;


  在08-3-2,marryme <beyond0924 at gmail.com> 写道:
    #include <iostream>
    #include <string>
    #include <iterator>
    #include <list>
    #include <algorithm>
    using namespace std;
    template<typename T, typename ForwardIterator=T::iterator>//模板的默认参数
    struct  print
    {

      void operator() (T& coll, ForwardIterator it=coll.begin() )//函数的默认参数
      {

        copy( coll.begin(),coll.end(),ostream_iterator<T::value_type>(cout,"\n"));

      }
    };



    _______________________________________________
    Cpp mailing list
    Cpp at codingnow.com
    http://codingnow.com/mailman/listinfo/cpp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codingnow.com/pipermail/cpp/attachments/20080303/d63d6dad/attachment.html


More information about the Cpp mailing list