Here's a puzzle: I'd like to define something like
typedef std::pair P;
I can obviously do
class P : public std::pair{};
or
typedef std::pair P;
The first gives me objects of class P where P.second is a pointer to a
subclass of what I really want. The second gives me something where,
with careful use of reinterpret_cast, I can create pointers to what I
really want.
The puzzle is can I create a standard pair where pair.second is a
pointer to an element of the class I've created without using
reinterpret_cast in some way?
There is a real point to this: I'd like to avoid reinterpret_cast so
that g++ can detect errors better in a complicated template class (a
protected subclass of std::multimap that can act like a linked list) but
am constrained to use std::pair and not some convenient derived class.
--
JDL