I am creating a class diagram for a class that has many definitions similar to this one inside of its header file.
1 2 3 4 5
const std::pair<Controller<_Tp,_Val>*, _Val>& getHighestBidder(_Tp obj) const;
I know what several of them do,
2) says that this method will return a std::pair<Controller<_Tp, _Val>*, _Val>
3) gives the name of the function
4) defines the type of object this function accepts as a parameter
But, what do 1 and 5 mean?
Any help/pointers would be great.
Thanks
Firstly, note that it’s not returning a
std::pair<Controller<_Tp, _Val>*, _Val>, it’s returning astd::pair<Controller<_Tp, _Val>*, _Val> &, i.e. a reference to such an object that already exists.(1) denotes that it’s a
constreference to an object; you cannot modify the object through this reference.(5) denotes that this is a
constmember function, i.e. it doesn’t modify the object it was called on.