Recently I was reading through the API of boost::optional
and came across the lines:
T const& operator *() const& ;
T& operator *() & ;
T&& operator *() && ;
I also wrote my own program that defines member functions as const&, & and && (Note that I am not speaking about the return type, but the specifiers just before the semi-colons) and they seems to work fine.
I know what it means to declare a member function const, but can anyone explain what it means to declare it const&, & and &&.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…