lundi 4 juillet 2016

Weird operator overloading, "operator T& () const noexcept { return *_ptr; }"

I studied that the format of operator functions is (return value)operator[space]op(arguments){implementation}. But, In std::reference_wrapper implementation, there is an operator overloading function declared as operator T& () const noexcept { return *_ptr; }.

Is this operator different from T& operator () const noexcept { return *_ptr; } ?. If both are different, then what is the use of the first?

Aucun commentaire:

Enregistrer un commentaire