Jean-Marc Lasgouttes wrote:
> A little digression: instead of our current os:: namespace, wouldn't
> it be better to have a hierarchy of os_foo classes with static
> methods, so that some environment could inherit others (like cygwin =
> unix + some stuff). The some of the code from this init method could
> be moved to os_foo.C files.

You can't have static virtual member functions, but you could have either 
a "class os" (à la 13x) or a "namespace os" (à la 14x) that hid the 
implementation:

class os {
public:
        static void init(int argc, char * argv[]);

        static string const & binpath();
        static string const & binname();
        static string const & homepath();
        static string const & nulldev();
private:
        struct impl {
                virtual string const & binpath() const = 0;
                virtual string const & binname() const = 0;
                virtual string const & homepath() const = 0;
                virtual string const & nulldev() const = 0;
        };
        static boost::scoped_ptr<impl> pimpl_;
};

Each os_cygwin, os_os2, os_unix, os_win32 class would inherit from 
os::impl.

However, I don't think that such a change should go in the 1.3.x series 
and I don't really see what it would give 1.4.x. Can we leave this for 
1.5.x?

-- 
Angus

Reply via email to