compiler : g++ of gcc4.5.2(minGW)
os : windows xp sp3(32bits)

template<typename T, template<typename> class CONT = AccumulationTraits >
class Accum
{
  public :
    static typename CONT<T>::AccT accum(T const *beg, T const *end)
    {
      typename CONT<T>::AccT total = CONT<T>::zero();
      while(beg != end)
      {
        total += *beg;
        ++beg;
      }
      return total;
    }
};

template<typename T, template<typename> class CONT = AccumulationTraits >
inline typename CONT<T>::AccT accum(T const *beg, T const *end)
{
  return Accum<T, CONT>::accum(beg, end);
}

The code like this work fine on gcc4.5.2
Is this a legal feature of C++0x or a special feature support by gcc?
I can't find any information from the C++0x faq maintain by Bjarne Stroustrup(maybe I missed it)
Thanks a lot

Recommended Answers

Default function template arguments have been added to C++0x, yes.

Jump to Post

All 2 Replies

Default function template arguments have been added to C++0x, yes.

Thank you very much, this could make things easier than the old days

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.