<div dir="ltr">That's actually exactly what I've done!   Check the code in HostThread.h in the original patch.  The difference is that instead of empty inheritance, I used a typedef.  But the idea is exactly the same.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 28, 2014 at 8:53 PM, Bruce Mitchener <span dir="ltr"><<a href="mailto:bruce.mitchener@gmail.com" target="_blank">bruce.mitchener@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">One approach that I've seen for this in games where virtual function calls are an unhappy thing is a pattern where the inheritance appears to be inverted:<div>
<br></div><div>In this case, you'd have each platform class in their own files and directory structure:</div>

<div><br></div><div>    class HostThreadMacOSX { ... };</div><div><br></div><div>    class HostThreadWindows { ... };</div><div><br></div><div>Then, you'd have a single HostThread.h that looked roughly like:</div><div>


<br></div><div><div>    if (__WIN32__)</div><div>    #include "threading/windows/HostThreadWindows.h"</div><div><br></div><div>    namespace lldb</div><div>    {</div><div>    class HostThread : public Windows::HostThreadWindows</div>


<div>    { </div><div>    };<br></div><div>    }</div><div>    #elif __APPLE__</div><div>    #include "threading/macosx/HostThreadMacOSX.h"</div><div>    namespace lldb</div><div>    {</div><div>    class HostThread : public MacOSX::HostThreadMacOSX</div>


<div>    {</div><div>    };<br></div><div>    }</div><div>    #else</div><div>    #error "lldb::HostThread not implemented on this platform!"</div><div>    #endif</div></div><div><br></div><div>Now, all of the code can reference HostThread, there are no virtual calls, and each platform can invoke platform-specific behavior with ease.</div>


<div><br></div><div>It has some downsides, like the exact interface of what is required isn't as clear (since there's no "interface" class), but I've had good luck with this structure in the past.</div>


<div><br></div><div>Hope this is interesting / useful!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div> - Bruce</div><div><br></div></font></span></div>
</blockquote></div><br></div>