
I've been exploring what a cross platform process library would look like and have a question about whether there is a preferred idiom for what I'll call an occasional property for lack of a better term. Given a process, I'd like to be able to query the parent process. Posix has such a notion, but win32 doesn't. On posix, afaik, every process has a parent except for "init." I can't decide whether I should say class process { public: process parent(); static const process nprocess; // like std::string's npos }; where parent() != nprocess when the process has a parent. or class process { public: typedef std::pair<process,bool> parent_type; parent_type parent(); }; where parent_type.second == true when the process has a parent. I also considered a "parent_iterator", since on posix, you could keep walking backwards up the hierarchy till you get to init, e.g. class parent_iterator; class process { public: parent_iterator parent(); }; but conceptually, I couldn't see a good "end()" Anyone care to offer an idea for the best way to handle this? jr