mercredi 2 septembre 2015

return a value without return type declaration in template, is this a typo?

I am watching the talk Modern Template Metaprogramming by Walter E. Brown. At 54:40 a code is given as below

template<class T, T v>
struct integral_constant{
  static constexpr T value = v;
   constexpr  operator T() const noexcept { return value; } // what does this mean?
   constexpr T operator T() const noexcept { return value; }
}

My question is what does this line mean constexpr operator T() const noexcept { return value; }, why there is no return type but it is still returning value? Is this a typo?

Aucun commentaire:

Enregistrer un commentaire