lundi 30 mars 2020

std::add_const, why the implementation works for reference?

In cppreference add_const it is said we may implement it as:

template< class T> struct add_const { typedef const T type; };

When I try a reference type, like std::add_const<int&>, it is int&.

My question is why it can work without a specific version for reference, since int& const is illegal?

Aucun commentaire:

Enregistrer un commentaire