I have typedefs like the following:
And, member variable declaration:
typedef std::map<bookKey, bookValues> TBookMap;
** Question **
Is it possible to create an API to obtain:
The pointer or reference to the TBookKey (set), and TBookValues (vector) of the a specific pair from the bookMap? (Not a copy of them)
I think, if I define the API signature such as:
The caller will always get a copy of TBookKey and TBookValues of the specified (bookID) pair, but not the pointer/reference of the Key/Value. Because that the operator= of set/vector is overloaded to make a copy. Is it correct? Any suggestions/comments?
// iterate through BookMap to get the actual Key/Value reference of specified pair.
GetBookMapPair(const int bookID, TBookKey& key, TBookValues& value);